Thanks for the response.
No, there is only one column of manually entered names. It is a simple text file and although it was about 250 lines long with legitimate subdomain names, I have manually reduced it to two for testing.
If I actually copy the screen output of the command that is echoed and repaste it as a single line, it works as well.
For example, it will display on the screen:
...
cp -R -p /home/wp-stuff /home/admin/aname.mydomain.com/wp-content/plugins/wp-stuff: No such file or directory
If I manually copy everything before the colon and paste it to a new line it works fine.
Here is an actual screen copy of me doing that, I have just changed the names for security.
-bash-3.2# ./clong.sh
copying plugin...
./clong.sh: line 23: cp -R -p /home/wp-stuff /home/admin/name1.mydomain.com/wp-content/plugins/wp-stuff: No such file or directory
done
copying plugin...
./clong.sh: line 23: cp -R -p /home/wp-stuff /home/admin/name2.mydomain.com/wp-content/plugins/wp-stuff: No such file or directory
done
-bash-3.2# cp -R -p /home/wp-stuff /home/admin/name2.mydomain.com/wp-content/plugins/wp-stuff
-bash-3.2#
As you can see, I copied the last line before the : (ctrl C) and repasted (mouse right click) it into the same ssh window and it worked without a hitch. (Yes the file copy worked, I checked.)
Other than me changing the subdomain and domain name here in this post, this is a ctrl C of the ssh screen and a ctrl V to here.
I really am baffled by this. The only things that I can come up with are;
- My bash is broken.
- The cat function is pulling in an invisible character that is screwing it up.
---------- Post updated at 02:27 PM ---------- Previous update was at 02:05 PM ----------
Here is the -x printout from the script.
-bash-3.2# ./clong.sh
+ IFS='
'
+ IFS='
'
++ cat nlist.txt
+ for line in '`cat nlist.txt`'
+ dbuser=name1
+ echo 'copying plugin...'
copying plugin...
+ deststr=/home/admin/name1.mydomain.com/wp-content/plugins/wp-stuff
+ movestr='cp -R -p /home/wp-stuff /home/admin/name1.mydomain.com/wp-content/plugins/wp-stuff'
+ 'cp -R -p /home/wp-stuff /home/admin/name1.mydomain.com/wp-content/plugins/wp-stuff'
./clong.sh: line 23: cp -R -p /home/wp-stuff /home/admin/name1.mydomain.com/wp-content/plugins/wp-stuff: No such file or directory
+ echo done
done
+ for line in '`cat nlist.txt`'
+ dbuser=name2
+ echo 'copying plugin...'
copying plugin...
+ deststr=/home/admin/name2.mydomain.com/wp-content/plugins/wp-stuff
+ movestr='cp -R -p /home/wp-stuff /home/admin/name2.mydomain.com/wp-content/plugins/wp-stuff'
+ 'cp -R -p /home/wp-stuff /home/admin/name2.mydomain.com/wp-content/plugins/wp-stuff'
./clong.sh: line 23: cp -R -p /home/wp-stuff /home/admin/name2.mydomain.com/wp-content/plugins/wp-stuff: No such file or directory
+ echo done
done
-bash-3.2#