ps can have multi-space delimiters, while cut -d" " handles one-space delimiters. [ ] must be within quotes, otherwise the shell matches it against the current directory.
Enough reasons for awk:
Maybe AIX ps has Posix options? These are more efficient:
Most efficient would be to only grep for the command not its arguments (and you don't need the [ ] trick):
And another optimization is to replace the loop by ---------- Post updated at 01:41 PM ---------- Previous update was at 01:27 PM ----------
Back to the original problem.
A for loop on multi-word lines is problematic
It's broken into words. A work-around is
But, as I see now, it is filtered by awk, that gives one word per line, and I don't see a real problem...
Last edited by MadeInGermany; 09-26-2014 at 03:46 PM..
Hi all,
I'm developing a system which requires me to run a ksh script from within a cgi script. What sort of syntax will I need to do this, I'm sure it's simple but can't find out how anywhere!
Thanks. (1 Reply)
i want to add about 60 printers using a ksh script.
i am having trouble though, i am reading the input from the hosts file and using the lpadmin command to add like so:
lpadmin -p -v /dev/null -m netstandard -o dest=
i want printername and ipaddy to come from the hosts file, i am having... (1 Reply)
Hello all,
Here's the scenario:
I've got a script, let's call it script1. This script invokes another script, which we'll call set_env, via the dot "." command, like so:
File:
#!/bin/ksh
#
region_id=DEV
. set_env ${region_id}
and so on. Script set_env sets up an... (2 Replies)
Hi,
I'm new to unix scripting.How can i call a script from another script.
I have a.ksh and b.ksh .I have to call b.ksh from a.ksh after it is successfully exceuted.
I tried using
#!/bin/ksh -x in a.ksh and at the end i have used /path/b.ksh
My problem is it is executing only a.ksh.it... (6 Replies)
Hi,
I am in ksh.
below mentioned 3 commands I executed at command prompt & got the expected results.
csh
source csh_infa
<special command>
Now I have to do this in the script in ksh. I entered it as it is.
#!/bin/ksh
csh
source csh_infa
<special command>
Now after... (1 Reply)
KSH isn't my strong suit but it's what my company has to offer. I've got a script with two nested loops, a FOR and UNTIL, and that works fine. When I add a CASE into the mix I end up getting "Unexpected 'done' at line xx" errors. Any suggestions on this?
for divi in at ce ci cm co de di fl... (9 Replies)
It's been a while since I used csh formatting and I am having a little bit of trouble with a few things. Things seem so much easier to execute in Matlab, however I need to do this on the terminal because of the programs I am trying to interact with.
So here's what I want to do: I have a file... (0 Replies)
I am trying to call a ksh script from another ksh script.
in the called script , i am doing sum calculation(used typeset etc)
suppose a.ksh is the calling script and b.ksh is the called script .
. b.ksh (used this inside a.ksh)
this execution gives some error like bad number.
but when i... (1 Reply)
I'm having a brain freeze moment. I've created a ksh script in AIX that ssh's to a remote server, executes some commands, and then logs out. All of this is sent to a file. I then have the script cat the file so i can see the output. Even though the cat command is outside of the remote session part;... (5 Replies)