Friday, April 1, 2016
Linux Bash Shell Script Function Argument Passing Examples
April 01, 2016
argument passing
,
beginner
,
code
,
directory listing
,
easy
,
explanation
,
folder recusive
,
function parameter passing
,
linux
,
recursive directory traversal
,
regex
,
regular expression
,
script
,
shell
,
tutorial
Code Function Argument To Read Argument File From Terminal line by line:
Save the code in a file named "FunctionArgumentPassing1.sh".Running the Code:
Just type the code below in terminal. Make sure to cd into that directory if you have not opened the terminal in that directory. Make sure to create the "log.txt" file in the same directory as the shell script file.bash FunctionArgumentPassing1.sh
Sample Input File:
Save as "log.txt".Code Function Argument Traverse Directories Recursively:
Save the code in a file named "FunctionArgumentPassing2.sh".Running the Code:
Just type the code below in terminal. Make sure to cd into that directory if you have not opened the terminal in that directory. Make a directory named "deletefolder" with more directories inside and inside them some files.bash FunctionArgumentPassing2.sh
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment