[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
return values of bash scripts
From: |
kc123 |
Subject: |
return values of bash scripts |
Date: |
Tue, 20 Dec 2011 14:18:16 -0800 (PST) |
i,
Could someone please help me figure out why:
GNU bash, version 3.2.25(1)-release-(x86_64-redhat-linux-gnu)
1) Why when I do an echo, I get /bin/sh returned as well ?
For example, my script below called crond.sh:
#!/bin/bash
SERVICE='crond'
HOST=`hostname`
content=`ps auxw | grep [c]rond| awk '{print $11}'`
echo "CONTENT:" $content
and output is:
CONTENT: /bin/bash /bin/bash crond
Why are there 2 extra arguments printed (/bin/bash)?
Also how do I get rid of the "/bin/bash /bin/bash" and just have
"crond" as output ?
2) I get a different output from the same script if I run snmpwalk:
part of another snmp script which calls crond.sh:
$PLACE.1.1) echo "string"; echo `bash /directory/crond.sh`; exit 0 ;;
and output is:
STRING: "CONTENT: /bin/sh bash bash crond
Why are there 3 extra arguments printed this time. Would like to just
output "crond".
Many thanks.
--
View this message in context:
http://old.nabble.com/return-values-of-bash-scripts-tp33012795p33012795.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.
- return values of bash scripts,
kc123 <=