Here is my code:
This will run the first part of the bash script but not the awk command. It therefore gives output of:
I am actually trying to just extract the filesize, which works correct when the bash command is run in isolation, meaning that perhaps I have a syntax error somewhere inside my backticks...?
---------- Post updated at 03:01 AM ---------- Previous update was at 02:25 AM ----------
Just to answer my own post as in retrospect, it was a really stupid question.
The answer is, don't use bash, use perl as it is more than capable of carrying out these small functions!
I had previously written the script in bash and i'm in the process of converting the functionality to perl. I guess I got caught up in re-using my previous code from the bash script.
Anyway, I did this in perl instead:
It does the job.
Last edited by Scrutinizer; 04-25-2012 at 04:29 AM..
Reason: code tags
I'm attempting to write a bash script that will create a network between virtual machines. It accepts three arguments: an RSpec that describes the network topology, and two list of machines (servers and clients).
I have a (working) Perl script that I want to call. This Perl script takes an RSpec... (6 Replies)
Hi,
I am trying to run a python script embedded in bash script. But is throwing me an error. Please help.
Script:
#!/bin/bash
nohup /usr/bin/python /opt/web/http.py &
Error:
/usr/bin/python: can't open file '/opt/web/http.py': No such file or directory
Please help me on this. (6 Replies)
I have been testing a new script and cannot figure out why my `cat spath` will not execute on the remote machine?
sudo ssh -p 22344 -o "PasswordAuthentication no" -o "HostbasedAuthentication yes" -l testuser 192.168.1.6 "find `cat spath` -depth"
cat: spath: No such file or directory
but... (0 Replies)
In a bash script, one can call a perl command in the following manner, where "myperlcommand" is a perl command.
perl -e 'myperlcommand(arguments)'
perl -e 'print("UUUU"x4)'
Now, how can one call a bash command from within a perl script? (Suppose that mybashcommand is a bash... (1 Reply)
Hi everyone. This is a bit of a perl/linux mixed question. I am trying to redirect STDOUT of chsh by using the following line of perl code.
system ("chsh -s /sbin/nologin $testing 1>/dev/null");
This should redirect STDOUT to /dev/null but it won't do that for some odd reason. Any ideas or... (6 Replies)
Hi
I m new to perl. I m trying to write a perl script that calls a bash script; does anyone have a script already that they can provide or help me out? Thanks a lot. (2 Replies)
I have the following ksh-script:
#!/bin/ksh
# Ueberprüfe, ob genau ein Parameter angegeben wurde
test "$#" -eq "1" || { echo "USAGE: path_cleanup <PATH_NAME>"; return 1; }
# Ueberpruefe, ob awk und nawk installiert sind
test -x /bin/nawk || { echo "ERROR: nawk is not installed"; return 1;... (2 Replies)
Novice to perl here.
I have created a simple web page in perl, with only one submit button. I would like to execute a bash script on the same server when this button is clicked on.
Is this possible in perl? I have spent a few days researching this and am unable to find any useful information.... (0 Replies)
Hello,
I have a problem with package and name space.
require "/Mehran/DSGateEngineLib/general.pl";
use strict;
sub System_Status_Main_Service_Status_Intrusion_Prevention
{
my %idpstatus;
my @result;
&General_ReadHash("/var/dsg/idp/settings",\%idpstatus);
#print... (4 Replies)
Can someone explain the difference between backticks and system when
evaluated in these if statements:
sub getDate {
print "start date\n";
if ( system("/bin/date") ) {
print "can't get date\n";
exit(2);
}
print "finish date\n";
}
Returns the following:
start date
Thu... (5 Replies)