Stop shell wildcard character expansion?

后端 未结 4 1513
Happy的楠姐
Happy的楠姐 2020-11-22 11:05

Is there any way for a compiled command-line program to tell bash or csh that it does not want any wildcard characters in its parameters expanded?

For instance, one

4条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 11:10

    Beware: if there are no names matching the mask, bash passes the argument as-is, without expansion!

    Proof (pa.py is a very simple script, which just prints its arguments):

     $ ls
    f1.cc  f2.cc  pa.py
     $ ./pa.py *.cc
    ['./pa.py', 'f1.cc', 'f2.cc']
     $ ./pa.py *.cpp
    ['./pa.py', '*.cpp']
    

提交回复
热议问题