02-07-2007
Both approaches are correct what really matter is your choice.
you can create file using ">" operator and later you can append on same file with ">>" operator.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
i have a problem running vi. there is no space in /var where it creates tmp file. How can I change this parameter so that it takes from other directory.
thanks (4 Replies)
Discussion started by: ajaya
4 Replies
2. UNIX for Dummies Questions & Answers
Hi,
How can I attach a file using sendmail?
I tried /A option like this:
$ /usr/bin/sendmail toaddress@gmail.com /A afile.txt
but doesn't seem to work.
- Monkfan (2 Replies)
Discussion started by: monkfan
2 Replies
3. Solaris
Hi,
I have created a service referring the below link.
https://www.unix.com/tips-tutorials/32987-creating-solaris10-service.html
Now am able to import and enable the service.
I have placed my xml file under
/var/svc/manifest/site
The service name is
<service
... (3 Replies)
Discussion started by: kalpeer
3 Replies
4. Shell Programming and Scripting
Hi all
I am doing some matching apache access log processing.Now i want a some way that i can start log search/process from where it left.Can any one give me ideads. (1 Reply)
Discussion started by: aliahsan81
1 Replies
5. Shell Programming and Scripting
Hi
HOWTO create in UNIX a Microsoft Excel sheet (with data from Oracle). At the moment I am making CSV files (using SQL statemens with || ';'), but search for more advanced formatting. Don't wish to use Perl.
cheers (4 Replies)
Discussion started by: slashdotweenie
4 Replies
6. AIX
Hi
howto extract a file from a bff file? Is it possible?
thanks
Israel. (1 Reply)
Discussion started by: iga3725
1 Replies
7. Shell Programming and Scripting
Hi
I have a file with this inside:
How can I change it to:
thanks a lot
regards
Israel. (3 Replies)
Discussion started by: iga3725
3 Replies
8. Red Hat
Hi guys!
I have around 300 hostsname is excelsheet in one column. These hosts I want to add in one file in linux one after the another like hostname1,hostname2.hostname3,
I don't want to waste enter it manually it very time consuming, so how to transfer these files from excelsheet to a... (1 Reply)
Discussion started by: manalisharmabe
1 Replies
9. Shell Programming and Scripting
Hi,
I am converting a .DBF file to pipe delimited file
my requirement is like
lets say my .DBF is residing in path /a/b/c/d/f/abc.DBF
I need my .txt file as
having a column with source _cd =f
sample data in .DBF in folder "f"
c1 c2 c3
1 2 3
in txt file it should be... (4 Replies)
Discussion started by: angel12345
4 Replies
10. Shell Programming and Scripting
Hi Gurus,
I have a file which contains some special char or space.
when using cat -evt I can see the file as following:
0,"0000","abc/def aaa ... (6 Replies)
Discussion started by: ken6503
6 Replies
LEARN ABOUT CENTOS
shell-quote
SHELL-QUOTE(1) User Contributed Perl Documentation SHELL-QUOTE(1)
NAME
shell-quote - quote arguments for safe use, unmodified in a shell command
SYNOPSIS
shell-quote [switch]... arg...
DESCRIPTION
shell-quote lets you pass arbitrary strings through the shell so that they won't be changed by the shell. This lets you process commands
or files with embedded white space or shell globbing characters safely. Here are a few examples.
EXAMPLES
ssh preserving args
When running a remote command with ssh, ssh doesn't preserve the separate arguments it receives. It just joins them with spaces and
passes them to "$SHELL -c". This doesn't work as intended:
ssh host touch 'hi there' # fails
It creates 2 files, hi and there. Instead, do this:
cmd=`shell-quote touch 'hi there'`
ssh host "$cmd"
This gives you just 1 file, hi there.
process find output
It's not ordinarily possible to process an arbitrary list of files output by find with a shell script. Anything you put in $IFS to
split up the output could legitimately be in a file's name. Here's how you can do it using shell-quote:
eval set -- `find -type f -print0 | xargs -0 shell-quote --`
debug shell scripts
shell-quote is better than echo for debugging shell scripts.
debug() {
[ -z "$debug" ] || shell-quote "debug:" "$@"
}
With echo you can't tell the difference between "debug 'foo bar'" and "debug foo bar", but with shell-quote you can.
save a command for later
shell-quote can be used to build up a shell command to run later. Say you want the user to be able to give you switches for a command
you're going to run. If you don't want the switches to be re-evaluated by the shell (which is usually a good idea, else there are
things the user can't pass through), you can do something like this:
user_switches=
while [ $# != 0 ]
do
case x$1 in
x--pass-through)
[ $# -gt 1 ] || die "need an argument for $1"
user_switches="$user_switches "`shell-quote -- "$2"`
shift;;
# process other switches
esac
shift
done
# later
eval "shell-quote some-command $user_switches my args"
OPTIONS
--debug
Turn debugging on.
--help
Show the usage message and die.
--version
Show the version number and exit.
AVAILABILITY
The code is licensed under the GNU GPL. Check http://www.argon.org/~roderick/ or CPAN for updated versions.
AUTHOR
Roderick Schertler <roderick@argon.org>
perl v5.16.3 2010-06-11 SHELL-QUOTE(1)