Passing a full pathname as arguments to a script [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












-7















I need to write a shell script that gets a full filename PATH, as a command line argument, and displays the file.










share|improve this 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















-7















I need to write a shell script that gets a full filename PATH, as a command line argument, and displays the file.










share|improve this 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













-7












-7








-7








I need to write a shell script that gets a full filename PATH, as a command line argument, and displays the file.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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












  • 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










1 Answer
1






active

oldest

votes


















1














#!/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.






share|improve this answer





























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    #!/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.






    share|improve this answer



























      1














      #!/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.






      share|improve this answer

























        1












        1








        1







        #!/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.






        share|improve this answer













        #!/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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 22 at 14:47









        KusalanandaKusalananda

        136k17257426




        136k17257426












            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?