Quantcast
Channel: Problem with entire function in a script - Unix & Linux Stack Exchange
Browsing latest articles
Browse All 5 View Live

Answer by mikeserv for Problem with entire function in a script

svcs network/shell | sed -n '/^online /c\ True' >> Solaris.txt ...should be pretty much the equivalent. The reason your script doesn't show anything, though, is that shell function is shell code...

View Article



Answer by A.B. for Problem with entire function in a script

I believe, there is a shorter way: svcs network/shell | awk '/online/ {system("bash -c \"compare_ser "$1"\"")}' Dear Downvoters, can you explain your decision? Have you understand, what Linux really...

View Article

Answer by roaima for Problem with entire function in a script

Use this: svcs network/shell | cut -d' ' -f1 | grep "online" | xargs -n1 -I{} bash -c 'compare_ser {}' The {} interpolates each value generated through xargs. Your $@ attempts to interpolate command...

View Article

Answer by sureshraju for Problem with entire function in a script

You may have to use double quotes for the string to resolve the positional parameters. svcs network/shell | cut -d ' ' -f1 | grep "online" | xargs -n1 bash -c "compare_ser $@"

View Article

Problem with entire function in a script

I want to detect online network/shell services in my Solaris. I write following script for this purpose: compare_ser() { if [ "$1" != "" ]; then echo "True" >> Solaris.txt fi } export -f...

View Article

Browsing latest articles
Browse All 5 View Live




Latest Images