Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

directories with spaces using diff command 2

Status
Not open for further replies.

rigstars2

Instructor
Dec 18, 2011
64
US
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!
 
Perhaps this ?
sudo diff -r [!]"[/!]$ORIGINAL[!]"[/!] [!]"[/!]$COPY[!]"[/!] >> $CHANG

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
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
 
The "[tt]echo $?[/tt]" would be giving the return variable of the last command, which would be the "[tt]sudo[/tt]" in this case. All you are testing is that the [tt]sudo[/tt] worked.

 
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
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
And this ?
Code:
sudo diff -r "'$ORIGINAL'" "'$COPY'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top