Here is the goal of the script : there are 3 parameters oldfile, newfile, pathofoldfile (and oldfile and newfile always got the same name) the script should get the oldfile date information put them on the new file and send the newfile to the pathofoldfile and overwritre the oldfile
I would like that the script ask me : 1/ pathofoldfile 2/ name of file (since its the same for the old and the new one)
Warning : there will be space in the pathofolfile string (like /test 121/with more/spa ce/file)
Here is the actual buggy script :
#!/bin/sh if [ -z "$1" ] | [ -z "$2" ] | [ -z "$3" ]; then echo "Usage: $0 {initialFile} {destinationFile} {destinationPath}" exit 1 fi echo 'changing attributs of '$1' to '$2'...' touch -r $1 $2 echo 'done!' echo '' echo 'Moving '$2' to '$3'...' mv $2 $3 echo 'done!' echo ''
Not made by me, don't know anything about linux scripts... For the moment the script just says it can't find the path of anything.
Thanks for any help !
I've finaly solved the pb myself, here is my final script :
echo 'changing attributs of '$1' to '$2'...' touch -r "$1"/$2 $2 echo 'done!' echo '' echo 'Moving '$2' to '$1'...' mv $2 "$1" echo 'done!' echo ''