10 More Discussions You Might Find Interesting
I need to ftp the whole file structure from various unix servers to a windows server
I have a sub script for each machine and am using
ftp -is:../%name%_prog.bat -i %server% on the windows side.
The problem then comes with the mget command
it gets all the files , but puts them in one... (4 Replies)
Discussion started by: madmacher
2. Red Hat
I have just been bothered by a fairly small issue for some time now. I am trying to search (using find -name) for some .jpg files recursively. This is a Redhat environment with bash.
I get this job done though I need to copy ALL of them and put them in a separate folder BUT I also... (1 Reply)
Discussion started by: rockf1bull
I am new to linux and Programming.
Inside the file stdio.h, there is a description about FILE structure. Which has many internal data members like _p, _r, _flags etc.
I have written a sample code to find out the contents of the FILE structure.
It opens a sample file ( FILE *fp ),... (5 Replies)
Discussion started by: nikunjbadjatya
4. Shell Programming and Scripting
printf "$FBOLD\nPlease enter the minutes (0-59): $FREG"
case "$MIN" in
||s) break 2;;
echo "Invalid minutes, please try again.";;
In the above... (4 Replies)
Discussion started by: milink
5. Shell Programming and Scripting
I have file like this
120, rahim, d40
115, rahul, d40
113, begum, d40
I want to group this file like this
120, rahim, d40
can any one help me on this
thanks in advance (1 Reply)
Discussion started by: trichyselva
Before i start doing something, I wanted to know whether the approach to compare XML file with UNIX file system structure. I have a pre-configured file(contains a list of paths to executables) and i need to check against the UNIX directory structure. what are the various approches should i use ? I... (6 Replies)
Discussion started by: shafi2all
7. Shell Programming and Scripting
To test server migration, we need to compare files under a directory in source and target servers.
I need to verify if the below two directories on two servers are identical (i.e., contains same directories and files with same size. They may have multiple level sub-directories)
... (3 Replies)
Discussion started by: krishmaths
I am trying to find out ways of comparing a value from a 'c' structure to a value in another 'C' structure. the 'C' structure can be a List or liked list as it contains lot many records.
if we loop it in both the structures it is going to consume time.
I am looking for a simple... (3 Replies)
Discussion started by: dhanamurthy
9. UNIX for Dummies Questions & Answers
I need to tar only the file structures in Unix.
I dont want to create the tar with the files in it.
I tried to use a find with type -d and xargs the tar. It still tar's the file. Can anybody can help in this?
Anand (1 Reply)
Discussion started by: Andysundar
10. UNIX for Dummies Questions & Answers
Is it possible to copy a structure of a directory only.
I have a file with the following entries that is a result of a find :-
I want to copy these to a directory and keep the structure however starting at a new dir... (8 Replies)
Discussion started by: jhansrod
SHELL-QUOTE(1p) User Contributed Perl Documentation SHELL-QUOTE(1p)
shell-quote - quote arguments for safe use, unmodified in a shell command
shell-quote [switch]... arg...
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.
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.
[ -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:
while [ $# != 0 ]
case x$1 in
[ $# -gt 1 ] || die "need an argument for $1"
user_switches="$user_switches "`shell-quote -- "$2"`
# process other switches
eval "shell-quote some-command $user_switches my args"
Turn debugging on.
Show the usage message and die.
Show the version number and exit.
The code is licensed under the GNU GPL. Check http://www.argon.org/~roderick/ or CPAN for updated versions.
Roderick Schertler <firstname.lastname@example.org>
perl v5.8.4 2005-05-03 SHELL-QUOTE(1p)