Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ksh script problem

Status
Not open for further replies.

dcomit

Technical User
Jun 20, 2001
115
GB
I can't get this script to work.
What I want to do is to write the date and the result of the ps into the file test.log.
It runs but I don't get anything in the logfile.

#!/bin/ksh
#
DA=`date`
DB=`ps -eoargs | grep lm_qdx5.2_production`
echo $DA >> test.log
echo $DB >> test.log

Any help would be appreciated.

Dave
 
Have you tried some debugging like set -x as first command ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Still nothing.
I've tried putting in a line:
echo "Running"

but nothing is displayed.
 
What's the name of your script and how are you running it? A common mistake is to name a script "test" which is also the name of a shell builtin.
 
....or better yet naming it "script".

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Hi,
Can you pls suggest something for this...

I have a file


Serial ID : 3HY0RV8R



# Vol Emulation Dev Type Mirror Status Cap(MB)
1 1 FBA 0004 Data 1 Ready 8
2 2 FBA 0027 RAID-S Data 1 Ready 8632
8 8 FBA 00A7 RAID-S Data 1 Ready 8632
5 5 FBA 00C7 RAID-S Data 1 Ready 8632
3 3 FBA 0144 RAID-S Parity 2 Ready 8632
6 6 FBA 0187 RAID-S Data 1 Ready 8632

Serial ID : 3HY0RYMR



# Vol Emulation Dev Type Mirror Status Cap(MB)
1 18 FBA 0012 Data 1 Ready 8
10 27 FBA 026F RAID-S Data 1 Ready 8632

And I want to make it like this...(The line# are not consistant and also the SR#)


Serial ID : 3HY0RV8R



# Vol Emulation Dev Type Mirror Status Cap(MB)
3HY0RV8R 1 1 FBA 0004 Data 1 Ready 8
3HY0RV8R 2 2 FBA 0027 RAID-S Data 1 Ready 8632
3HY0RV8R 8 8 FBA 00A7 RAID-S Data 1 Ready 8632
3HY0RV8R 5 5 FBA 00C7 RAID-S Data 1 Ready 8632
3HY0RV8R 3 3 FBA 0144 RAID-S Parity 2 Ready 8632
3HY0RV8R 6 6 FBA 0187 RAID-S Data 1 Ready 8632


Serial ID : 3HY0RYMR



# Vol Emulation Dev Type Mirror Status Cap(MB)
3HY0RYMR 1 18 FBA 0012 Data 1 Ready 8
3HY0RYMR 10 27 FBA 026F RAID-S Data 1 Ready 8632


Serial ID : 3HY0SAZL

Thanks,
 
next time, pls start a new thread.

nawk -f vptl.awk file

Code:
BEGIN {
  FS=":"
}

$1 ~ /Serial/ { sn=$2 ; print; next}

$1 ~ /^[ ]+#/ || $0 ~ /^[ ]*$/ { print; next }

{ print sn, $0 }

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Sounds like you're not finding anything with the grep command.
 
vgersh99: that's really really really nice!!! that kind of codes make me realize that I know just a little bit of scripting!

Cheers.
 
Where is your test.log located? You might be looking at
a different copy of test.log. Tell the script where the
test.log is located and rerun your script.

example... put TESTLOG="${HOME}/TEST.log"

then just echo to >> TESTLOG...after the run go to your
home directory and check if TEST.log is there.
 
Thanks everybody, my script is working ok now. The problem was down to file permissions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top