1

Below is my .sh file

sh summaryByClient.sh $1 - takes around 10 mins to fetch the required data
mv summary.html ~/public_html/chats/ - **this is not happening**
exit 0

I do not understand why mv summary.html ~/public_html/chats/ this is not working inside .sh file, However I am able to mv separately using the same above command.

  • You have tagged your question as *shell*. In a POSIX shell, the tilde does not expand to the home directory. Also not that *is not working* is an extremely poor way to describe the effect. Does it mean you get an error message? Does it mean that your computer crashes? Does it mean that the command is silently executed, but the file is not there? – user1934428 May 03 '18 at 08:48

1 Answers1

0

Could you be running into the issue from this answer with expanding the user's home directory? What happens if you write your script like this:

#!/bin/bash

# Other tasks to retrieve summary.html done here
mv ./summary.html $HOME/public_html/chats/
exit 0

Also, it's always a good idea to check whether the destination directory exists before a mv command. Examples are shown in this answer