Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Get home dir from shell

by kennethk (Abbot)
on Apr 03, 2013 at 14:29 UTC ( #1026866=note: print w/ replies, xml ) Need Help??


in reply to Get home dir from shell

since it considers $HOME as a variable
Which is why you escape it: perl -e 'print `echo \$HOME`'

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.


Comment on Re: Get home dir from shell
Download Code
Re^2: Get home dir from shell
by vit (Pilgrim) on Apr 03, 2013 at 15:13 UTC
    It will print $HOME
      moo@cow>perl -e 'print `echo \$HOME`' /home/moo
      ~$ perl -e 'print `echo $HOME`' ~$ perl -e 'print `echo \$HOME`' /home/kennethk ~$ perl -e 'print `echo \\$HOME`' \ ~$ perl -e 'print `echo \\\$HOME`' $HOME ~$ perl -e '$q = chr 39; print `echo $q\$HOME$q`' $HOME ~$ perl -e '$loc = q{\$HOME}; print `echo $loc`' $HOME
      Try outputting your command to make sure it's what you think it is.

      #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

        Two more:

        c:\>perl -e "print `echo \%HOME\%` " c:\brocmi c:\>perl -e "print `echo %HOME%` " crocmi

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2015-07-04 18:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls