Question

Im learning bash and I have a question about how to copy files from fatherly folder into another folder when user types "0". (for example from K2 to K1) And I don't know how to do so.

#!/bin/bash
echo $1 $2 $3 $4
K1=$1
K2=$2
if [ $4 -eq "0" ] then
cp -v ../$2/*.{png,bmp,jpg,xcf,pcx} .
cp -v ../$2/*.{png,bmp,jpg,xcf,pcx} ./$1
fi

that's all I wrote, could you help me..?

Was it helpful?

Solution

A possible script:

#!/bin/bash
echo -n "Type your number: "
read ANSWER
if [ "$ANSWER" == "0" ] ; then
    # Put here your cp commands
fi
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top