I’m trying to switch the contents of two files via temp file using the code;
#!/bin/bash
...
mv $FILE1 $TEMP
mv $FILE2 $FILE1
mv $TEMP $FILE2
When I run this, it returns for each line number
swap.sh: line 18: mv: command not found
Thanks in advance.
Probably you are unsetting PATH variable with shell parameters.
Try adding full paths to commands, for example
Using command which you can figure out what is correct path:
Alternatively you can try setting PATH at the beginning of script, for example:
This is system dependent. You can see the default PATH by running
in your shell.