Questions tagged «argv»



8
如何在函数内访问调用方的命令行参数?
我试图用bash编写一个函数,该函数将访问脚本的命令行参数,但是将其替换为该函数的位置参数。如果未显式传递命令行参数,该函数是否可以访问命令行参数? # Demo function function stuff { echo $0 $* } # Echo's the name of the script, but no command line arguments stuff # Echo's everything I want, but trying to avoid stuff $*
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.