Do you know where your variables are? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hello, long time lurker, first time poster.
I'm trying to use system() in list mode like so:
However, I just get $PATH as output instead of the value of my path. Background: 1. Linux. 2. I'm not actually echo'ing anything in my real code, but I can't even get this unit test to work. My code is supposed to set $PATH, then run a command on the same line, in the same shell. 3. Unless I can temporarily set my $ENV{PATH} variable without having to manually reset it, then don't tell me to use that. It makes no sense to me to set a global variable for a temporary shell. Apparently other-forum goers don't know about OOP. 4. I successfully did this using system() in scalar context (one string arguement, ok it's not actually scalar but w/e). 5. I'm trying to do this in order to handle spaces in path names (which shouldn't appear in linux but it's better safe than sorry). If another way can be used to resolve this issue then that works too! Thanks Edit: Apparently monks can't read either. So far most of the answers provided are relevant to what I'm trying to achieve. 5. I'm trying to do this in order to handle spaces in path names (which shouldn't appear in linux but it's better safe than sorry). If another way can be used to resolve this issue then that works too! Edit 2: Ok here's my code. The second system call is supposed to set my PATH to something (it's actually something but not relevant; also, long), then run a script. For output I get: $PATH env: bash: No such file or directory Any help is appreciated. Bullsh*t not so much. In reply to System() in list mode? by 1337John
|
|