[Bash] Print out how many number of arguments and arguments Posted by Computer Newbie on 凌晨2:06 in bash script / No comments Bash Script : args=("$@") Number=("$#") echo $# arguments passed for i in $(seq 0 1 $Number) do echo ${args[$i]} done Result : Happy@Happy-laptop:~/Desktop$ bash test123.sh 1 2 3 4 5 6 7 8 8 arguments passed 1 2 3 4 5 6 7 8 Reference : In Bash, how do you access command line arguments inside a function? Bash For Loop Examples Share This: Facebook Twitter Google+ Stumble Digg 以電子郵件傳送這篇文章BlogThis!分享至 X分享至 Facebook Related Posts:[Bash Script][xdotool][Embedded System] How to use script to download firmware automatically [Bash Script][xdotool][Embedded System] How to use script to download firmware automatically #!/bin/bash # cp file from A place to tftp DATE=`date +… Read More[Bash] How to use sed to understand slash (\) in the string [Bash] How to use sed to understand slash (\) in the string If I have \ (slash) in the string. But everytime I use \ command, the sed will recognize… Read More[Bash scipt][CVS] Download code from CVS server #!/bin/bash # cp file from A place to tftp DATE=`date +%Y%m%d-%H-%M` cd /home/JOHN/ mkdir $DATE cd $DATE source /opt/HAPPY cvs checkout HAPPY cd - c… Read More[Linux][Bash script] Redirecting standard output and standard error [Linux][Bash script] Redirecting standard output and standard error 3.6.4 Redirecting Standard Output and Standard Error This construct allows… Read More[Sed] Remove space line in the file[Sed] Remove space line in the filesed '/^$/d;' -i test.htmFind all of the htm file replace it. find ./ -name '*.htm' -print | xargs sed -i '/^$/d;'Re… Read More
0 意見:
張貼留言