Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: passing parameters from shell script to perl program doesn't preserve spaces

by kschwab (Priest)
on Dec 20, 2016 at 16:43 UTC ( #1178224=note: print w/replies, xml ) Need Help??


in reply to passing parameters from shell script to perl program doesn't preserve spaces [solved]

This works, at least in bash:

$ args=(one "two three" four "five six") $ perl -e 'for (@ARGV) {print "$_\n"}' "${args[@]}" one two three four five six
  • Comment on Re: passing parameters from shell script to perl program doesn't preserve spaces
  • Download Code

Replies are listed 'Best First'.
Re^2: passing parameters from shell script to perl program doesn't preserve spaces
by peterbk (Initiate) on Dec 21, 2016 at 09:34 UTC
    Thanks @all for the hints.
    Parameter passing from shells seems to be not as easy as I had thought.
    Thus I have added another parameter to my perl program, which tells it to read the parameters from a file instead of the command line.
    This works like desired and circumvents shell interpretations.
      oh! if you admit to read params from files you can find Modules as configuration files an interesting solution.

      Mixing it with xargs made it easy.



      L*

      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1178224]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2018-07-16 14:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (342 votes). Check out past polls.

    Notices?