Linux / UNIX Tech Support Forum
This is a discussion on save command and command output within the CentOS / RHEL / Fedora forums, part of the Linux Distribution category; Dear forum friends, I have a shell script which contains 5 linux commands. I want to save both commands as ...
|
|||||||
| CentOS / RHEL / Fedora Discussion about Redhat Enterprise Linux or CentOS or Fedora Linux related problems. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Dear forum friends,
I have a shell script which contains 5 linux commands. I want to save both commands as well as each command output into separate log file. How can I do this. Thanks & regards Savook |
| Sponsored Links | ||
|
|
|
||||
|
Yes, you can do it as follows:
Code:
#!/bin/bash MEM=/tmp/memory.output CPU=/tmp/cpuinfo.output echo "Memory output: " >$MEM free -m >> $MEM echo "CPU output: " >$CPU cat /proc/cpuinfo >> $CPU
__________________
Vivek Gite Linux Evangelist |
![]() |
| Tags |
| cat , command output , free , shell scripting , unix command output to a file |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| print a "FTP dir command" output into a .txt file | ecompean | Shell scripting | 2 | 09-02-2009 11:34 PM |
| Automate command execution - reboot-command execution | ganeshp@moris.org | Shell scripting | 2 | 03-12-2008 11:18 AM |
| How can I redirect the output of time command to file | warren | Linux software | 13 | 25-08-2006 11:17 AM |
| How do I use the tar command? | jerry | All about FreeBSD/OpenBSD/NetBSD | 1 | 22-06-2006 02:05 PM |
| How can I get some specific characters of dd command output | warren | Shell scripting | 2 | 24-05-2006 03:59 PM |