command line parameters
i wrote a program using gcc in linux which processes some text files, whose names are fed into the program as command line arguments.
Now the problem is when i give something like "*.java" (for example "./align *,java", the command line arguments automatically gets filled with names of all the files matching "*.java", which i DONT want.
As far as i remember the the program worked fine few days back until i found a bug and decided to bebug and rebuild it.
Any suggestion ?
Z
Sounds like your shell is preprocessing your command before it runs; cant imagine why that would suddenly be the case now as to a previous build, but try using escape characters. In general:
"metacharacter" enclose the meta character in double quotes.
(The shell interprets $, back quotes and backslash.)
''metacharacter'' enclose the meta character in single quotes.
(The shell interprets nothing within the quotes.)
\metacharacter precede the meta character with a back slash.
(Escapes the single following character.)
These are obviously general rules; if you''re using a non-std shell, it may not world. In general I suggest:
./align "*.java" or ./align \*.java
"metacharacter" enclose the meta character in double quotes.
(The shell interprets $, back quotes and backslash.)
''metacharacter'' enclose the meta character in single quotes.
(The shell interprets nothing within the quotes.)
\metacharacter precede the meta character with a back slash.
(Escapes the single following character.)
These are obviously general rules; if you''re using a non-std shell, it may not world. In general I suggest:
./align "*.java" or ./align \*.java
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement