Hello,
I am making a script to copy files interactively from one directory to another using the "i" option because I dont want to overwrite the files.
cp -i *.html ./../otherdir/
cp: do you want to overwrite (y/n) ?
I used
cp -i *.html ./../otherdir/
ans='n'
read $ans
But the script is unable to pickup the value as "n" as a response to the
shell output -
cp: do you want to overwrite (y/n) ?
try using "yes" command
read man page of yes
man yes
yes|cp -i A B
would only give me "y" as an answer which means permission to overwrite.
I want to give "n" as an answer to the question since i dont want to overwrite -
cp : do you want to overwrite(y/n) ?
Is there some command oppsite to "yes"
Yes is only for affirmative answers , I want a negative answer so that the file being copied is not overwritten.
I used this - yes no|cp A B
is still overwriting file B with A.
If I give
yes no |cp -i A B
then interactive message comes.
overwrite ./a/1.txt? ki023b[/icvdev1/gr7885]>