-1

I have this line in a script:

mv -f Tasting/bin/release/net5.0/osx-x64/tasting.zip /Users/thomas/Downloads

and it returns:

mv: rename Tasting/bin/release/net5.0/osx-x64/tasting.zip to /Users/thomas/Downloads/tasting.zip: Not a directory

but if I run the same line from the shell, it executes properly. Why is that?

6
  • Did you try specify the full path for mv? Also try appending echo to the command and see what is actually executed in the script.
    – Joy Jin
    Sep 9 at 9:08
  • the fullpath works, echo outputs the command as is. I don't get why running it in a script changes the output though; I'll investigate if some prior commands could have changed the path
    – Thomas
    Sep 9 at 9:18
  • 2
    Can you show a minimal shell script demonstrating the problem? The output of zsh -x yourScript might be useful, and the output of type mv and pwd immediately before the failing mv is executed.
    – Martin R
    Sep 9 at 9:29
  • set -x (dumps all commands as they are executed) and pwd (prints current working directory) may be helpful; you probably run mv in a different directory than you intend to.
    – DarkDust
    Sep 9 at 9:29
  • Also what directory are you running the script from and your command line
    – mmmmmm
    Sep 9 at 9:48

You must log in to answer this question.

Browse other questions tagged .