One small complication when running programs from within a shell is that the
shell will sometimes substitute a pattern for a set of arguments. For example,
consider this run in the Bash shell:
You can disable shell expansion by quoting the argument, but actually most of the time it is a very useful feature once you are aware of it.
$ ./command.py *.txtYou might expect the following output:
Executable: ./command.py Arg: *.txtbut this isn't what you get. Instead the output depends on the number of .txt files in the current working directory. When I run it I get this:
Executable: ./command.py Arg: errors.txt Arg: new.txt Arg: output.txtThe Bash shell substitutes the *.txt command for the filenames of all the .txt files in the current directory so your program recieves more arguments than you might have expected.
You can disable shell expansion by quoting the argument, but actually most of the time it is a very useful feature once you are aware of it.
$ ./command.py "*.txt" Executable: ./command.py Arg: *.txt
Comments
Post a Comment
https://gengwg.blogspot.com/