Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Keep up the good work - excellent site - i'd been looking for something like this for ages !..."

Geography

Where in the world do Tek-Tips members come from?

directories with spaces using diff commandHelpful Member!(2) 

rigstars2 (Instructor)
31 Mar 12 12:01
Hey Everyone,

ORIGINAL="Library/Internet Plug-Ins"
COPY="/MyStuff/watch/Internet Plug-Ins"

The ORGININAL directory has extra files there so when I run the
command below, I'd expect it the find the differences between the 2
variables but it doesn't. Any help is appreciated. I'm thinking, it is not handling the spaces correctly with the directory names.

sudo diff -r $ORIGINAL $COPY >> $CHANG

Thanks!
PHV (MIS)
31 Mar 12 13:12
rigstars2 (Instructor)
31 Mar 12 15:49
Nice try PH but it doesn't give the output. I ran "echo $?" immediately afteward to see what the error code would be it was never 0   
SamBones (Programmer)
2 Apr 12 13:11
The "echo $?" would be giving the return variable of the last command, which would be the "sudo" in this case. All you are testing is that the sudo worked.

 
Helpful Member!  Annihilannic (MIS)
3 Apr 12 1:40
sudo does faithfully return the return code of the last command executed:

CODE

# sudo true ; echo $?
0

# sudo false ; echo $?
1
# sudo ksh -c 'exit 6' ; echo $?
6
#

Annihilannic
tgmlify - code syntax highlighting for your tek-tips posts

Helpful Member!  PHV (MIS)
3 Apr 12 3:50

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close