bp4a has asked for the wisdom of the Perl Monks concerning the following question:
I am running the following system command:
df -h | grep /db2/$DB2DBDFT/sapdata
in my script and assigning it to a variable which I then later print to a file and the file is then put in an email.
When I run the command at the prompt I get this:
df -h | grep /db2/$DB2DBDFT/sapdata 30G 26G 2.1G 93% /db2/BXP/sapdata1 30G 11G 18G 37% /db2/BXP/sapdata2 30G 23G 5.9G 80% /db2/BXP/sapdata3 30G 6.0G 23G 22% /db2/BXP/sapdata4 2.0G 36M 1.9G 2% /db2/BXP/sapdatat 2.0G 36M 1.9G 2% /db2/BXP/sapdatat2
When I run the script I get this error:
sh: line 82: printf: `/': invalid format character
The line number is wrong for one thing but that is besides the point. Here is the code:
print OUT "Current File System Usage:\n"; print OUT "Filesystem Size Used Avail Use Mounted on\n"; $rc = `df -h | grep /db2/$DB2DBDFT/sapdata`; print OUT "$rc\n";
I think it has to do with the / in the "filesystem name" column or the "Mounted on" column. The weird thing is that I don't have this problem on Unix.
I appreciate any suggestions on how to handle this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: print question
by ikegami (Patriarch) on Jun 02, 2011 at 15:51 UTC | |
| |
|
Re: print question
by toolic (Bishop) on Jun 02, 2011 at 15:53 UTC | |
by bp4a (Initiate) on Jun 02, 2011 at 17:29 UTC | |
by ikegami (Patriarch) on Jun 02, 2011 at 18:23 UTC | |
by toolic (Bishop) on Jun 02, 2011 at 17:57 UTC | |
|
Re: print question
by flexvault (Monsignor) on Jun 03, 2011 at 12:27 UTC | |
by bp4a (Initiate) on Jun 03, 2011 at 19:43 UTC | |
|
Re: print question
by bp4a (Initiate) on Jun 03, 2011 at 14:04 UTC |