Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

semicolon for perl command in bash

by mianfeidewucan (Initiate)
on Oct 17, 2012 at 21:42 UTC ( #999613=perlquestion: print w/ replies, xml ) Need Help??
mianfeidewucan has asked for the wisdom of the Perl Monks concerning the following question:

Hi there,

When I wrote a bash file before (like ex.bash), I use a command like "perl example.pl;" in ex.bash. This bash file is for submitting jobs in a supercomputer. When I checked out recently, I found everything worked fine. Is it allowed in bash to write a perl command with semicolon? Or is it better for me to change "perl example.pl;" to "perl example.pl"?

Thank you,

Arrow

Comment on semicolon for perl command in bash
Re: semicolon for perl command in bash
by hippo (Deacon) on Oct 17, 2012 at 22:00 UTC

    The semi-colon in bash is the statement terminator. If you do not use a semi-colon then your statement is terminated by a newline. Both the semi-colon and the newline can be escaped. This is all to do with bash and nothing to do with perl.

    As examples try these:

    • $ echo foo
    • $ echo foo;
    • $ echo foo\;
    • $ echo foo; echo bar
    • $ echo foo\; echo bar

    Happy bashing!

      Hi,

      I didn't know the semicolon and newline are equivalent. Thank you very much!

      Arrow

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://999613]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2014-08-20 09:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (108 votes), past polls