Questions tagged [qx]

Used for the Perl qx// operator which executes a command and captures the output. The question should always have the Perl tag too.

See the Perl Quote-like operators manual pages for the details. The string between the markers (conventionally two slashes) is executed and the standard output from the command is captured. In a list context, each line is separate; in a scalar context, the whole output is captured as a single string.

20 questions
0
votes
1 answer

Why some commands are give different output when ran in Perl and in linux terminal

When I run this command: bjobs -r -P xenon -W | awk '{print $7}' | grep -v JOB_NAME | cut -f 1 -d ' ' | xargs in a terminal, all running JOB_NAMES are coming, but when I do this in per_script only JOB_ID are coming. Perl script code is…
0
votes
2 answers

Unable to get output from awk in a variable using Perl Script.

I am a newbie in Perl Scripting. I am working on code in which I have to get CPU utilization. I am trying to run a command and then get the output in a variable. But when I try to print the variable I get nothing on the scree. Command works fine in…
SarveshD
  • 5
  • 1
  • 2
0
votes
1 answer

perl: chdir in perl and call chdir from system

In my perl script, use chdir command from Perl iteself works well as following: chdir $fold_path but use qx call chdir command of linux doesn't work as following: qx(chdir $fold_path) so what is the reason? Not so clear!
Chris Bao
  • 2,418
  • 8
  • 35
  • 62
0
votes
1 answer

Certain binaries run while others don't (despite ls visibility and +x) from mod_perl2 script

On Apache 2.2 on CentOS 6.4 with perl 5.10.1. I'm trying to get a remote directory listing from within a mod_perl script, which apparently (if I die qx(id)) is running as apache. But I'm not even getting as far as being able to run ssh without…
Kev
  • 15,899
  • 15
  • 79
  • 112
0
votes
4 answers

Perl -> How return value of qx(perl file)

I need to know how is possible return values of Perl file from other Perl file. In my first file i call to the second file with sentence similar to: $variable = qx( perl file2.pl --param1 $p1 --param2 $p2); I have tried with exit and return to get…
Davidin073
  • 991
  • 4
  • 12
  • 25
1
2