English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

how to read ALL contents from the file in unix shell script.that is,i want the code to read contents from file .help

2007-02-20 10:25:25 · 4 answers · asked by mary 2 in Computers & Internet Programming & Design

4 answers

hi,
run it as... ./run.sh
************************************************
#!/bin/sh
terminal=`tty`

fname=$1

exec < $fname

while read line
do
echo $line
done

exec < $terminal

------------------------------...
chmod +x ./run.sh
./run.sh

2007-02-20 17:00:00 · answer #1 · answered by Anonymous · 0 0

'cat' will print the contents of a file to the screen, amongst other things depending on how you use it.
cat --help
or
man cat
You may want to pipe this to 'less' or 'more' if you're just trying to view the contents of the file.
Using cat on a binary file will give you a bunch of junk on the screen, in which case 'strings' will give you the readable data (strings) from the file.

2007-02-20 10:47:08 · answer #2 · answered by Anonymous · 0 0

The answer depends on what Operating System do you use. Windows and Linux shell scripting are both different. For most heavily secured companies, they often use Linux, mostly Red Hat, to protect their data as Linux is a lot more secure than Windows. So, I advice you to learn BOTH. They are not hard at all.

2016-05-23 23:58:54 · answer #3 · answered by Anonymous · 0 0

have you tried $ cat .help ?

2007-02-20 10:29:26 · answer #4 · answered by D 4 · 1 0

fedest.com, questions and answers