shell script:
I test that in terminal I get:
EDIT: The title post is inaccurate. I did get an error-message. The thing is I have to use -p option because the folder in question may actually be embedded in another folder that doesn't exist on my server, but still. And I'm logged in as root.
Code:
#http://stackoverflow.com/questions/17204092/bash-script-trouble-interpretting-input/17204840?noredirect=1#17204840
#!/bin/bash
addr=$(ifconfig -a | ./check_ip)
relpath=$(./strip /users/me/Desktop/place_on_server/ $2)
if [[ $1 = "DIR" ]]
then
shift
#( IFS=/; echo ssh "root@$addr" mkdir -p "/var/www/media/$*"; )
#( IFS=/; ssh "root@$addr" "mkdir -p /var/www/media/$*"; "chmod 755 /var/www/media/$*";)
#( ssh "root@$addr" "mkdir -p /var/www/media/$relpath"; "chmod 755 /var/www/media/$relpath"; )
( ssh "root@$addr" "cd /var/www/media"; "mkdir -p $relpath/"; "chmod 755 $relpath/"; )
elif [[ $1 = "F" ]]
then
shift
last=$#
file=${!last}
#( IFS=/; echo rsync "$file" "root@$addr:/var/www/media/$*" )
#( IFS=/; chmod 755 "$*"; rsync "$file" "root@$addr:/var/www/media/$*"; )
( IFS=/; chmod 755 "$*"; rsync "$file" "root@$addr:/var/www/media/$*"; )
else
echo "Unknown command '$1'"
fi
I test that in terminal I get:
Code:
me$ ./upload DIR /users/me/Desktop/place_on_server/test-folder
./upload: line 11: mkdir -p test-folder/: No such file or directory
./upload: line 11: chmod 755 test-folder/: No such file or directory
EDIT: The title post is inaccurate. I did get an error-message. The thing is I have to use -p option because the folder in question may actually be embedded in another folder that doesn't exist on my server, but still. And I'm logged in as root.