- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- syntax for varaiable with spaces
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 06:07 AM
тАО07-22-2009 06:07 AM
Script is as follows;
#!/usr/bin/sh
#
COPY_CMD=`rsync -avz`
#
LIST=`cat /home/allmerms/office_move/raid_mdb.txt`
#
DEST="/office"
#
#
for l in $LIST
do
$COPY_CMD "${l}" $DEST
done
Solved! Go to Solution.
- Tags:
- quoting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 06:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 06:22 AM
тАО07-22-2009 06:22 AM
Re: syntax for varaiable with spaces
+ /raid/documents/actuation/eng_pdu/Tony /office
./test_copy.sh[13]: /raid/documents/actuation/eng_pdu/Tony: not found.
+ Li/saved/MoveNewDesktop/work/PNcrossReference.mdb /office
./test_copy.sh[13]: Li/saved/MoveNewDesktop/work/PNcrossReference.mdb: not found.
The full path is;
"/raid/documents/actuation/eng_pdu/Tony Li/saved/work/PNcrossReference.mdb"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 06:23 AM
тАО07-22-2009 06:23 AM
Re: syntax for varaiable with spaces
Are those anything like _problems_? And do
we need to guess what they were, or might you
be persuaded to tell us?
> LIST=`cat /home/allmerms/office_move/raid_mdb.txt`
You have a file named "cat"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 06:23 AM
тАО07-22-2009 06:23 AM
Re: syntax for varaiable with spaces
By the way, the use of backticks is deprecated in favor of '$()' as:
# LIST=`cat /home/allmerms/office_move/raid_mdb.txt`
...is better written:
# LIST=$(cat /home/allmerms/office_move/raid_mdb.txt)
...which, is more _efficiently_ done as:
# LIST=$(< /home/allmerms/office_move/raid_mdb.txt)
...which causes the shell to perform the read of the file without forking a separate process (here, 'cat').
Regards!
...JRF...
- Tags:
- command substitution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 06:24 AM
тАО07-22-2009 06:24 AM
Re: syntax for varaiable with spaces
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 06:37 AM
тАО07-22-2009 06:37 AM
Re: syntax for varaiable with spaces
#!/usr/bin/sh
#
COPY_CMD="rsync -avz"
#
LIST=$(#
DEST="/office"
#
#
for l in $LIST
do
$COPY_CMD "${l}" $DEST
done
I am still getting the following error form the output:
sent 29 bytes received 20 bytes 98.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files could not be transferred (code 23) at main.c(892) [sender=2.6.8]
+ rsync -avz /raid/documents/actuation/eng_pdu/Tony /office
building file list ... rsync: link_stat "/raid/documents/actuation/eng_pdu/Tony" failed: No such file or directory (2)
done
sent 29 bytes received 20 bytes 98.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files could not be transferred (code 23) at main.c(892) [sender=2.6.8]
+ rsync -avz Li/saved/move/Program /office
building file list ... rsync: link_stat "/home/allmerms/office_move/Li/saved/move/Program" failed: No such file or directory (2)
done
In additions some of the file that where succesful are not what I expected. I wanted the full path created after /office
Exapmle:
"/raid/unigraphics/utils/var/tables/Teamcenter-DB.mdb"
Was created in /office as; /office/Teamcenter-DB.mdb
I was expecting;
"/office/raid/unigraphics/utils/var/tables/Teamcenter-DB.mdb"
I hope that I have explained my expectation correctly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 07:18 AM
тАО07-22-2009 07:18 AM
Re: syntax for varaiable with spaces
A failed stat() means that the file or directory isn't found (or readable). See if this helps you:
...
for l in ${LIST}
do
[ -f "${l}" ] || { echo "missing file: ${l}"; continue; }
DIR=$(dirname ${l})
echo ${COPY_CMD} "${l}" "${DEST}${DIR}"
done
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 07:35 AM
тАО07-22-2009 07:35 AM
Re: syntax for varaiable with spaces
Here is a log of the output from you latest suggested change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 08:29 AM
тАО07-22-2009 08:29 AM
Re: syntax for varaiable with spaces
> Here is a log of the output from you latest suggested change.
Without seeing what the input file for that run looks like, it is difficult to comment.
Regards!
...JRF...