Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Write to file
Name: Diaz Date: February 11, 2002 at 21:26:12 Pacific
Comment:
Hello i'm still new of using unix shell commands i'm gonna build a simple shell script that write to some file like "logs.txt" everytime the script is executed. the string that is going to be written to the file is static like "Succeed written to logs.txt"
how can i manage the write to file script ? thanks
Name: kendel Date: February 12, 2002 at 05:17:54 Pacific
Reply:
hi diaz,
try to redirect output to your logfile
write command > logs.txt k
0
Response Number 2
Name: James Boothe Date: February 12, 2002 at 06:07:21 Pacific
Reply:
The echo or print command is typical used for that, and as kendel states, redirect the output of the command to your file. The first command below will overwrite any existing file and start a new file, while the second command will either start a new file (if no file already) or will append to an existing file:
Summary: Hello, How do you write a file to a log file? and what kind of information should we write to it, say for example i want to delete a core file and write it to this log file. thanks ...
Summary: Hi, PS1="`uname -n`>" export PS1 I wanted to write above 2 lines in .profile using a script. But when it writes to a file, uname -n command will be excuted. That's i don't want. I need above 2 li...
Summary: 1. #! has the special meaning only when it's in the shell "script". If it is put in the command line, it's a regular comment. When you run the whole line: #!/usr/bin/ksh ; hostname >&3 ; STREAM_3_VAR=...