functions with touch [closed]

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












1















Why doesn't the following work?



function xyz() touch $1; 
xyz temp1.txt


I get an error



touch: missing file operand
Try `touch --help' for more information.









share|improve this question













closed as off-topic by DopeGhoti, Jeff Schaller, mosvy, steeldriver, GAD3R Jan 8 at 20:25


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – DopeGhoti, mosvy, steeldriver, GAD3R
If this question can be reworded to fit the rules in the help center, please edit the question.













  • Welcome to Unix&Linux at StackExchange! I just tried your two exact commands on bash and it worked for me... Can you double check your setup? Try type xyz to see what bash thinks the definition of your function is...

    – filbranden
    Jan 8 at 18:46






  • 1





    Did you perhaps run something more interesting, like xyz "file name with spaces"?

    – Jeff Schaller
    Jan 8 at 19:08











  • Sorry! It worked fine. Thank you for quick (and kind) responses.

    – user330468
    Jan 8 at 20:00















1















Why doesn't the following work?



function xyz() touch $1; 
xyz temp1.txt


I get an error



touch: missing file operand
Try `touch --help' for more information.









share|improve this question













closed as off-topic by DopeGhoti, Jeff Schaller, mosvy, steeldriver, GAD3R Jan 8 at 20:25


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – DopeGhoti, mosvy, steeldriver, GAD3R
If this question can be reworded to fit the rules in the help center, please edit the question.













  • Welcome to Unix&Linux at StackExchange! I just tried your two exact commands on bash and it worked for me... Can you double check your setup? Try type xyz to see what bash thinks the definition of your function is...

    – filbranden
    Jan 8 at 18:46






  • 1





    Did you perhaps run something more interesting, like xyz "file name with spaces"?

    – Jeff Schaller
    Jan 8 at 19:08











  • Sorry! It worked fine. Thank you for quick (and kind) responses.

    – user330468
    Jan 8 at 20:00













1












1








1








Why doesn't the following work?



function xyz() touch $1; 
xyz temp1.txt


I get an error



touch: missing file operand
Try `touch --help' for more information.









share|improve this question














Why doesn't the following work?



function xyz() touch $1; 
xyz temp1.txt


I get an error



touch: missing file operand
Try `touch --help' for more information.






bash shell-script






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 8 at 18:44









user330468user330468

61




61




closed as off-topic by DopeGhoti, Jeff Schaller, mosvy, steeldriver, GAD3R Jan 8 at 20:25


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – DopeGhoti, mosvy, steeldriver, GAD3R
If this question can be reworded to fit the rules in the help center, please edit the question.




closed as off-topic by DopeGhoti, Jeff Schaller, mosvy, steeldriver, GAD3R Jan 8 at 20:25


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – DopeGhoti, mosvy, steeldriver, GAD3R
If this question can be reworded to fit the rules in the help center, please edit the question.












  • Welcome to Unix&Linux at StackExchange! I just tried your two exact commands on bash and it worked for me... Can you double check your setup? Try type xyz to see what bash thinks the definition of your function is...

    – filbranden
    Jan 8 at 18:46






  • 1





    Did you perhaps run something more interesting, like xyz "file name with spaces"?

    – Jeff Schaller
    Jan 8 at 19:08











  • Sorry! It worked fine. Thank you for quick (and kind) responses.

    – user330468
    Jan 8 at 20:00

















  • Welcome to Unix&Linux at StackExchange! I just tried your two exact commands on bash and it worked for me... Can you double check your setup? Try type xyz to see what bash thinks the definition of your function is...

    – filbranden
    Jan 8 at 18:46






  • 1





    Did you perhaps run something more interesting, like xyz "file name with spaces"?

    – Jeff Schaller
    Jan 8 at 19:08











  • Sorry! It worked fine. Thank you for quick (and kind) responses.

    – user330468
    Jan 8 at 20:00
















Welcome to Unix&Linux at StackExchange! I just tried your two exact commands on bash and it worked for me... Can you double check your setup? Try type xyz to see what bash thinks the definition of your function is...

– filbranden
Jan 8 at 18:46





Welcome to Unix&Linux at StackExchange! I just tried your two exact commands on bash and it worked for me... Can you double check your setup? Try type xyz to see what bash thinks the definition of your function is...

– filbranden
Jan 8 at 18:46




1




1





Did you perhaps run something more interesting, like xyz "file name with spaces"?

– Jeff Schaller
Jan 8 at 19:08





Did you perhaps run something more interesting, like xyz "file name with spaces"?

– Jeff Schaller
Jan 8 at 19:08













Sorry! It worked fine. Thank you for quick (and kind) responses.

– user330468
Jan 8 at 20:00





Sorry! It worked fine. Thank you for quick (and kind) responses.

– user330468
Jan 8 at 20:00










1 Answer
1






active

oldest

votes


















0














Unable to replicate:



$ function xyz() touch "$1"; 
$ xyz temp1.txt
$ ls temp1.txt
temp1.txt





share|improve this answer





























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Unable to replicate:



    $ function xyz() touch "$1"; 
    $ xyz temp1.txt
    $ ls temp1.txt
    temp1.txt





    share|improve this answer



























      0














      Unable to replicate:



      $ function xyz() touch "$1"; 
      $ xyz temp1.txt
      $ ls temp1.txt
      temp1.txt





      share|improve this answer

























        0












        0








        0







        Unable to replicate:



        $ function xyz() touch "$1"; 
        $ xyz temp1.txt
        $ ls temp1.txt
        temp1.txt





        share|improve this answer













        Unable to replicate:



        $ function xyz() touch "$1"; 
        $ xyz temp1.txt
        $ ls temp1.txt
        temp1.txt






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 8 at 19:21









        DopeGhotiDopeGhoti

        44.3k55684




        44.3k55684












            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?