Passing a full pathname as arguments to a script [closed]
Clash Royale CLAN TAG#URR8PPP
I need to write a shell script that gets a full filename PATH, as a command line argument, and displays the file.
linux shell-script
closed as unclear what you're asking by Jeff Schaller, thrig, JdeBP, Christopher, jimmij Feb 22 at 16:33
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
I need to write a shell script that gets a full filename PATH, as a command line argument, and displays the file.
linux shell-script
closed as unclear what you're asking by Jeff Schaller, thrig, JdeBP, Christopher, jimmij Feb 22 at 16:33
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
No efforts seen.
– Prvt_Yadv
Feb 22 at 14:53
add a comment |
I need to write a shell script that gets a full filename PATH, as a command line argument, and displays the file.
linux shell-script
I need to write a shell script that gets a full filename PATH, as a command line argument, and displays the file.
linux shell-script
linux shell-script
edited Feb 22 at 15:49
Rui F Ribeiro
41.5k1483141
41.5k1483141
asked Feb 22 at 14:44
jainik pateljainik patel
1
1
closed as unclear what you're asking by Jeff Schaller, thrig, JdeBP, Christopher, jimmij Feb 22 at 16:33
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as unclear what you're asking by Jeff Schaller, thrig, JdeBP, Christopher, jimmij Feb 22 at 16:33
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
No efforts seen.
– Prvt_Yadv
Feb 22 at 14:53
add a comment |
1
No efforts seen.
– Prvt_Yadv
Feb 22 at 14:53
1
1
No efforts seen.
– Prvt_Yadv
Feb 22 at 14:53
No efforts seen.
– Prvt_Yadv
Feb 22 at 14:53
add a comment |
1 Answer
1
active
oldest
votes
#!/bin/sh
cat "$@"
The "$@"
would be expanded to all the script's command line arguments, individually quoted.
If this is an executable file called script.sh
, you would use it as
./script.sh file
to display the contents of file
. Or even
./script.sh file1 file2
to view two files after each other.
Though, it would be quicker just to type cat file
on the command line. Or less file
if you want a pager to view the file a screen-full at a time.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
#!/bin/sh
cat "$@"
The "$@"
would be expanded to all the script's command line arguments, individually quoted.
If this is an executable file called script.sh
, you would use it as
./script.sh file
to display the contents of file
. Or even
./script.sh file1 file2
to view two files after each other.
Though, it would be quicker just to type cat file
on the command line. Or less file
if you want a pager to view the file a screen-full at a time.
add a comment |
#!/bin/sh
cat "$@"
The "$@"
would be expanded to all the script's command line arguments, individually quoted.
If this is an executable file called script.sh
, you would use it as
./script.sh file
to display the contents of file
. Or even
./script.sh file1 file2
to view two files after each other.
Though, it would be quicker just to type cat file
on the command line. Or less file
if you want a pager to view the file a screen-full at a time.
add a comment |
#!/bin/sh
cat "$@"
The "$@"
would be expanded to all the script's command line arguments, individually quoted.
If this is an executable file called script.sh
, you would use it as
./script.sh file
to display the contents of file
. Or even
./script.sh file1 file2
to view two files after each other.
Though, it would be quicker just to type cat file
on the command line. Or less file
if you want a pager to view the file a screen-full at a time.
#!/bin/sh
cat "$@"
The "$@"
would be expanded to all the script's command line arguments, individually quoted.
If this is an executable file called script.sh
, you would use it as
./script.sh file
to display the contents of file
. Or even
./script.sh file1 file2
to view two files after each other.
Though, it would be quicker just to type cat file
on the command line. Or less file
if you want a pager to view the file a screen-full at a time.
answered Feb 22 at 14:47
KusalanandaKusalananda
136k17257426
136k17257426
add a comment |
add a comment |
1
No efforts seen.
– Prvt_Yadv
Feb 22 at 14:53