![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Direct the output of a script to a log file | autosys_nm | Shell Programming and Scripting | 5 | 08-27-2008 08:16 AM |
| compare file size from a output file from a script | moustik | Shell Programming and Scripting | 7 | 11-07-2007 10:17 AM |
| scp output fm script won't go to file | nmikes | Shell Programming and Scripting | 7 | 01-31-2007 06:53 PM |
| Output of script to a file | sumeet | UNIX for Advanced & Expert Users | 3 | 11-29-2006 12:12 PM |
| File name of a script output | cheo_pr | Shell Programming and Scripting | 3 | 09-01-2005 05:40 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
||||
|
Hello,
I am kinda new to Unix scripting, haven't really dabble very deep, but I am trying to at the moment. Currently I am attempting to create a install script for my software. However what i would like to do is EVERYTHING that is outputted to screen (Including user input), is sent to a log file of my chosing. E.g: variable set for Xfile name to X directory. I know this is probably quite trivial but i would love it if you could give me some help if at all possible. I am writing this sh script on on Linux (CentOS) . Also, if you have any good links to some good Shell scripts commands or cheat sheets that would be awesome!. Many thanks again. |
|
||||
|
type
echo put this in a file called file.txt > file.txt using the ">" you just output to a file.txt cat file.txt want to add something else use ">>" to put more on the end echo i want to add more stuff to my file.txt >> file.txt cat file.txt put this in a file called file.txt i want to add more stuff to my file.txt IS THAT WHAT YOU WANTED? |
|
||||
|
I understand how to use "> log_file" but that would only work for one command, and i would have to put that everywhere in the script!
I want everything that my script outputs to the screen placed in a log file, including user input. Is there no an easier way of doing this? Such as Start Script -- Create logfile/Start recording -- Commands issued by the script Commands issued by the script Commands issued by the script Commands issued by the script User input Commands issued by the script Commands issued by the script Commands issued by the script Stop recording End of script. |
|
||||
|
if you are using linux ( redhat or centos in particular, as I have to explored on other Nix'es ) are you looking for : script command
[root@server ~]# script Script started, file is typescript [root@server ~]# ls -l typescript -rw-r--r-- 1 root root 0 Oct 4 17:20 typescript [root@server ~]# cat typescript [root@server ~]# ls -l typescript -rw-r--r-- 1 root root 0 Oct 4 17:20 typescript [root@server ~]# vi 123 [root@server ~]# vi 12345 [root@server ~]# ls -l typescript -rw-r--r-- 1 root root 0 Oct 4 17:20 typescript [root@server ~]# [root@server ~]# exit Script done, file is typescript [root@server ~]# ls -l typescript -rw-r--r-- 1 root root 1375 Oct 4 17:21 typescript [root@server ~]# cat typescript Script started on Sat 04 Oct 2008 05:20:08 PM IST [root@server ~]# ls -l typescript -rw-r--r-- 1 root root 0 Oct 4 17:20 typescript [root@server ~]# cat typescript [root@server ~]# ls -l typescript -rw-r--r-- 1 root root 0 Oct 4 17:20 typescript [root@server ~]# vi 123 [root@server ~]# vi 12345 [root@server ~]# ls -l typescript -rw-r--r-- 1 root root 0 Oct 4 17:20 typescript [root@server ~]# [root@server ~]# exit Script done on Sat 04 Oct 2008 05:21:02 PM IST [root@server ~]# |
![]() |
| Bookmarks |
| Tags |
| linux commands, unix commands |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|