Link to home
Start Free TrialLog in
Avatar of Guddi Yadav
Guddi YadavFlag for United States of America

asked on

Shell script - File name as a parameter

Hi,
   How do I pass file name as a parameter in shell script ?
Thanks
ASKER CERTIFIED SOLUTION
Avatar of Yujin Boby
Yujin Boby
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think i mentioned that one of your paths looked wrong in a previous question. Maybe that's the problem. afaicr it began /Downloads
Avatar of noci
noci

Inside the script you can refer to it. as the variable $1 (first parameter).
THIS is what i was referring to above
As Yujin said:

./my_shell_script FILE_NAME_HERE

Open in new window


and in your script use:

FILE=$1
cat $FILE

Open in new window