Hi Corona, as usually, your solution are the best, i got the idea, but your way produce me others doubts, for example the "\" with that spaces at the end of each line, for what are they?
It lets you break one long line across several lines to make it easier to read and edit. It's the same as if it'd been crammed all onto one big line.
For example,
Quote:
The other question, if i use this code just like you put it on, show, or print me, it works?
When you run it, it should print things like rm file1 file2 file3 file4 ... to the screen.
It's not running rm file1 file2 file file4, it's running echo rm file1 file2 file3 file4 which prints to the screen.
Quote:
Just one line to delete at the end?
No, that line is important, it tells it what to do.
Quote:
And the last one, why should i remove the echo?
Because with the echo, it will run echo rm filename, printing filenames to the screen for you to check if it's finding the right files.
Once you remove the echo, it will be running rm filename, and actually trying to remove the files.
xargs transforms text into arguments. These two commands are equivalent, for instance:
If you leave -exec off of find it just does its default action instead, which is, print every filename on a separate line. If you feed that into xargs commandname, it will run commandname with the filenames as arguments. If it's too many filenames to fit into one call, it will run commandname several times.
So, find without xargs:
find with xargs:
The version with -exec is preferable if you can, because spaces and quote-characters in filenames and paths can confuse xargs. -exec has no such problem, to the point that find is a useful tool for removing files which somehow ended up with humanly untypable names.
Last edited by Corona688; 09-21-2012 at 12:43 PM..
Hello i have question that i want check syntax from my script shell with sh -n filename
but it's not show something even i have wrong syntax in my file. why can this happened or any other way to check it?
i use on header of file :
#!/bin/sh
thx before :) (7 Replies)
hello everyone
i am beginner on shell scripting .and i am working on my project work on ad hoc network
i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem "
syntax error near unexpected token `('... (1 Reply)
Hi,
I am a unix newbie. I need to write a script to check wheteher another script is still running. If it is, then sleep for 30m and then check again if the script is running. If the script has stopped running then, I need to come out of the loop.
I am using RHEL 5.2 (2 Replies)
Hello All,
I looking for a way to verify the correction of shell script syntax.
Is there any switch like -c in perl which do this in shell ?
Thank You. (1 Reply)
I wish to seach a Dir for a specific file, once the file is found i will perform additional logic. If the file is not found within two hours, i would like to exit.
Logically, I'm looking for the best way to approach this
Thanks for any assistance in advance.
Note: I'm using a C shell and... (2 Replies)
I've made an awk command that works successfully.
However I'd like to add one character to it.
For example instead of /what_i_have_now/
I'd like to change just ONE field to the opposite with an exclamation point.
Like this: ! /what_i_have_now/
My question, where am I supposed to place... (1 Reply)