# This is my sample script #!/bin/sh
# script to display file system packages and s/w packages
ech
0 -e " system packages " >> /tmp/infoshell.sh
rpm -qa | sort | less >> /tmp/infoshell.sh
echo -e " file system profile " >> /tmp/infoshell.sh
df -a | cut -d" " -f1 >> /tmp/infoshell.sh
cat /tmp/infoshell.sh | morerm -f /tmp/infoshell.sh
Hi, i think, u'll need to re-organize ur script. It's a bit confusing to read ur script. :p
1. I suggest u do this as a good practice:
#!/bin/sh
# script to display file system packages and s/w packages
# Step 1 - Write the word " system packages " to file /tmp/infoshell.sh
echo -e " system packages " >> /tmp/infoshell.sh
# Step 2 - Write all the sorted rpm packages to file /tmp/infoshell.sh
rpm -qa | sort | less >> /tmp/infoshell.sh
# Step 3 - Write all th word "file system profile " to file /tmp/infoshell.sh
echo -e " file system profile " >> /tmp/infoshell.sh
# Step 4 - Write the disk usage to file /tmp/infoshell.sh
df -a | cut -d" " -f1 >> /tmp/infoshell.sh
# Step 5 - Read the file /tmp/infoshell.sh and display with "more"
cat /tmp/infoshell.sh | more
# Step 6 - Remove file /tmp/infoshell.sh
rm -f /tmp/infoshell.sh
2. Do not use "less" command in a script to redirect to a file. Omit the "less" command.
rpm -qa | sort | [b]less[/b] >> /tmp/infoshell.sh
3. Do not use file with "*.sh" file extension to represent a normal text file. It's a bit misleading.
That's my suggestion.
Cheers,
Dragon