Hi diskless.solve !
First, usually in a Bash script/program, a line that starts with the "pound"/"hash" character, that is the
# character, is a comment. It's only the first line of the file, where
# followed by
! is special.
So if you want four commands in a single Bash program, you only need this line:
as the first line; you don't need to repeat that line later in the file. Anywhere other than the first line, it's just a comment.
The -x option to Bash turns on "debugging" output, which displays program commands while the bash program is running. The +x options turns off debugging output.
You can see for yourself that
#! on only the first line of the file, is special, by trying this Bash program. Put these lines in a single file, and execute the file:
Code:
#!/bin/bash -x
echo Hello.
#!/bin/bash +x
echo Goodbye.
If you put those lines in a file called:
then make the file "executable" by running this command in the directory where you put the file:
Code:
chmod u+x ./test_bash.bash
and finally execute the file this way:
You'll see that both
echo commands are displayed. If you change the
-x on the first line to
+x neither echo command will be displayed. That's because only the first line in the file is having any affect. The later line that starts with
#! is just a comment, it has no affect in controlling the program. If it was having an effect controlling the program, it would turn off the debugging output, so you wouldn't see the second echo command displayed when the program runs.
So your Bash program should look more like this:
Code:
#!/bin/bash
lftp -f /root/desktop/autoupdater/thescript.sh
mount ...
cp /mnt/Temp /mnt/MyFolder
umount /mnt/MyFolder
where "
mount ..." needs to be replaced by whatever the mount command actually is.
As has already been mentioned, we need to also have some idea what's in the lftp script, and you need to make sure that the directories you are trying to use, actually do exist.
If there's something private in the lftp script, or in the mount command such as usernames, passwords, whatever, just replace them with things like $USERNAME $PASSWORD etc., we'll understand what you mean.
We just need to make sure the
structure of the lines in the lftp script file, and the
structure of the mount command, are all correct.
Hope this helps!