-1

I want to move all files from one folder to other folder using shell script. This is my code but it throws error

    #!/bin/sh
    SRC = '/home/xxx/test1/'
    DESTN = '/home/xxx/test/'
    mv SRC DESTN

Error:./move.sh:2:./move.sh:SRC:not found
      ./move.sh:2:./move.sh:SRC:not found
      mv:cannot stat 'SRC': No such file or directory
User123
  • 1,498
  • 2
  • 12
  • 26
Anuradha
  • 21
  • 1
  • 1

1 Answers1

2

When declaring shell variables, you cannot add spaces between the variable name and the = sign, nor between the = and the value.

Also remember to add $ before the variable name when using it after its declaration.

Your script should look like this one:

#!/bin/sh
SRC="/home/xxx/test1/*"
DESTN="/home/xxx/test"
mv "$SRC" "$DESTN"