Mount doesn't work in script [closed]
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I try to mount an iso file from a script, but it doesn't work. However the same command functions normally when executed from bash. Why? I'm suspecting it's because the command needs sudo
.
sudo mount -t iso9660 myiso.iso mydir 2> /dev/null
This is the exact command I have in my script. No errors when I run the script (2> /dev/null
, duh), but not even when I remove this part, since the script simply doesn't mount. I've tried running the script with sh script.sh
and nothing happens, same by running ./script.sh
. The script has full permissions.
When I execute this command in bash it works, if I remove the /dev/null
part it gives the typical warning that the file was mounted in read-only mode.
#! /bin/bash
mkdir mydir
sudo mount -t iso9660 myiso.iso mydir
That's my script.
shell-script scripting mount sudo iso
closed as unclear what you're asking by Scott, Stephen Rauch, Jeff Schaller, sebasth, jasonwryan Nov 5 '17 at 2:34
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
 |Â
show 6 more comments
up vote
1
down vote
favorite
I try to mount an iso file from a script, but it doesn't work. However the same command functions normally when executed from bash. Why? I'm suspecting it's because the command needs sudo
.
sudo mount -t iso9660 myiso.iso mydir 2> /dev/null
This is the exact command I have in my script. No errors when I run the script (2> /dev/null
, duh), but not even when I remove this part, since the script simply doesn't mount. I've tried running the script with sh script.sh
and nothing happens, same by running ./script.sh
. The script has full permissions.
When I execute this command in bash it works, if I remove the /dev/null
part it gives the typical warning that the file was mounted in read-only mode.
#! /bin/bash
mkdir mydir
sudo mount -t iso9660 myiso.iso mydir
That's my script.
shell-script scripting mount sudo iso
closed as unclear what you're asking by Scott, Stephen Rauch, Jeff Schaller, sebasth, jasonwryan Nov 5 '17 at 2:34
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
Yes,mount
(usually) requires privileges (e.g.,sudo
).â In the script, are you giving the fullsudoâ¯mountâ¯â¦
command that you show above, or justmountâ¯â¦
?â What happens?â Does it ask for a password?â Does it give an error message?âÂÂHow are you running the script?â Are you running it withsudo
?â Are you running it withâ¯&
?â Do not respond in comments; edit your question to make it clearer and more complete.
â Scott
Nov 5 '17 at 0:10
Now it is more clear. However, "I" is always uppercase on English. If I see next time an "i" from you, I won't fix your post, rather I will silently vote for "leave closed".
â peterh
Nov 5 '17 at 13:02
@roaima Not true, see here: unix.stackexchange.com/posts/402390/revisions He knew this rule very well. Btw, also you could give him a reopen vote, if you think the question deserves it.
â peterh
Nov 5 '17 at 13:44
@roaima Can't you simply write the solution in a comment? It would help a lot
â Escu Esculescu
Nov 5 '17 at 16:43
@roaima Did what you asked and reduced the script to the basic format by excluding unessential bits. Problem still remains. It's as if the script makes mydir and then ends without any errors or anything.
â Escu Esculescu
Nov 5 '17 at 17:09
 |Â
show 6 more comments
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I try to mount an iso file from a script, but it doesn't work. However the same command functions normally when executed from bash. Why? I'm suspecting it's because the command needs sudo
.
sudo mount -t iso9660 myiso.iso mydir 2> /dev/null
This is the exact command I have in my script. No errors when I run the script (2> /dev/null
, duh), but not even when I remove this part, since the script simply doesn't mount. I've tried running the script with sh script.sh
and nothing happens, same by running ./script.sh
. The script has full permissions.
When I execute this command in bash it works, if I remove the /dev/null
part it gives the typical warning that the file was mounted in read-only mode.
#! /bin/bash
mkdir mydir
sudo mount -t iso9660 myiso.iso mydir
That's my script.
shell-script scripting mount sudo iso
I try to mount an iso file from a script, but it doesn't work. However the same command functions normally when executed from bash. Why? I'm suspecting it's because the command needs sudo
.
sudo mount -t iso9660 myiso.iso mydir 2> /dev/null
This is the exact command I have in my script. No errors when I run the script (2> /dev/null
, duh), but not even when I remove this part, since the script simply doesn't mount. I've tried running the script with sh script.sh
and nothing happens, same by running ./script.sh
. The script has full permissions.
When I execute this command in bash it works, if I remove the /dev/null
part it gives the typical warning that the file was mounted in read-only mode.
#! /bin/bash
mkdir mydir
sudo mount -t iso9660 myiso.iso mydir
That's my script.
shell-script scripting mount sudo iso
edited Nov 6 '17 at 21:46
roaima
39.9k546109
39.9k546109
asked Nov 4 '17 at 23:16
Escu Esculescu
123
123
closed as unclear what you're asking by Scott, Stephen Rauch, Jeff Schaller, sebasth, jasonwryan Nov 5 '17 at 2:34
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as unclear what you're asking by Scott, Stephen Rauch, Jeff Schaller, sebasth, jasonwryan Nov 5 '17 at 2:34
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
Yes,mount
(usually) requires privileges (e.g.,sudo
).â In the script, are you giving the fullsudoâ¯mountâ¯â¦
command that you show above, or justmountâ¯â¦
?â What happens?â Does it ask for a password?â Does it give an error message?âÂÂHow are you running the script?â Are you running it withsudo
?â Are you running it withâ¯&
?â Do not respond in comments; edit your question to make it clearer and more complete.
â Scott
Nov 5 '17 at 0:10
Now it is more clear. However, "I" is always uppercase on English. If I see next time an "i" from you, I won't fix your post, rather I will silently vote for "leave closed".
â peterh
Nov 5 '17 at 13:02
@roaima Not true, see here: unix.stackexchange.com/posts/402390/revisions He knew this rule very well. Btw, also you could give him a reopen vote, if you think the question deserves it.
â peterh
Nov 5 '17 at 13:44
@roaima Can't you simply write the solution in a comment? It would help a lot
â Escu Esculescu
Nov 5 '17 at 16:43
@roaima Did what you asked and reduced the script to the basic format by excluding unessential bits. Problem still remains. It's as if the script makes mydir and then ends without any errors or anything.
â Escu Esculescu
Nov 5 '17 at 17:09
 |Â
show 6 more comments
1
Yes,mount
(usually) requires privileges (e.g.,sudo
).â In the script, are you giving the fullsudoâ¯mountâ¯â¦
command that you show above, or justmountâ¯â¦
?â What happens?â Does it ask for a password?â Does it give an error message?âÂÂHow are you running the script?â Are you running it withsudo
?â Are you running it withâ¯&
?â Do not respond in comments; edit your question to make it clearer and more complete.
â Scott
Nov 5 '17 at 0:10
Now it is more clear. However, "I" is always uppercase on English. If I see next time an "i" from you, I won't fix your post, rather I will silently vote for "leave closed".
â peterh
Nov 5 '17 at 13:02
@roaima Not true, see here: unix.stackexchange.com/posts/402390/revisions He knew this rule very well. Btw, also you could give him a reopen vote, if you think the question deserves it.
â peterh
Nov 5 '17 at 13:44
@roaima Can't you simply write the solution in a comment? It would help a lot
â Escu Esculescu
Nov 5 '17 at 16:43
@roaima Did what you asked and reduced the script to the basic format by excluding unessential bits. Problem still remains. It's as if the script makes mydir and then ends without any errors or anything.
â Escu Esculescu
Nov 5 '17 at 17:09
1
1
Yes,
mount
(usually) requires privileges (e.g., sudo
).â In the script, are you giving the full sudoâ¯mountâ¯â¦
command that you show above, or just mountâ¯â¦
?â What happens?â Does it ask for a password?â Does it give an error message?âÂÂHow are you running the script?â Are you running it with sudo
?â Are you running it withâ¯&
?â Do not respond in comments; edit your question to make it clearer and more complete.â Scott
Nov 5 '17 at 0:10
Yes,
mount
(usually) requires privileges (e.g., sudo
).â In the script, are you giving the full sudoâ¯mountâ¯â¦
command that you show above, or just mountâ¯â¦
?â What happens?â Does it ask for a password?â Does it give an error message?âÂÂHow are you running the script?â Are you running it with sudo
?â Are you running it withâ¯&
?â Do not respond in comments; edit your question to make it clearer and more complete.â Scott
Nov 5 '17 at 0:10
Now it is more clear. However, "I" is always uppercase on English. If I see next time an "i" from you, I won't fix your post, rather I will silently vote for "leave closed".
â peterh
Nov 5 '17 at 13:02
Now it is more clear. However, "I" is always uppercase on English. If I see next time an "i" from you, I won't fix your post, rather I will silently vote for "leave closed".
â peterh
Nov 5 '17 at 13:02
@roaima Not true, see here: unix.stackexchange.com/posts/402390/revisions He knew this rule very well. Btw, also you could give him a reopen vote, if you think the question deserves it.
â peterh
Nov 5 '17 at 13:44
@roaima Not true, see here: unix.stackexchange.com/posts/402390/revisions He knew this rule very well. Btw, also you could give him a reopen vote, if you think the question deserves it.
â peterh
Nov 5 '17 at 13:44
@roaima Can't you simply write the solution in a comment? It would help a lot
â Escu Esculescu
Nov 5 '17 at 16:43
@roaima Can't you simply write the solution in a comment? It would help a lot
â Escu Esculescu
Nov 5 '17 at 16:43
@roaima Did what you asked and reduced the script to the basic format by excluding unessential bits. Problem still remains. It's as if the script makes mydir and then ends without any errors or anything.
â Escu Esculescu
Nov 5 '17 at 17:09
@roaima Did what you asked and reduced the script to the basic format by excluding unessential bits. Problem still remains. It's as if the script makes mydir and then ends without any errors or anything.
â Escu Esculescu
Nov 5 '17 at 17:09
 |Â
show 6 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
1
Yes,
mount
(usually) requires privileges (e.g.,sudo
).â In the script, are you giving the fullsudoâ¯mountâ¯â¦
command that you show above, or justmountâ¯â¦
?â What happens?â Does it ask for a password?â Does it give an error message?âÂÂHow are you running the script?â Are you running it withsudo
?â Are you running it withâ¯&
?â Do not respond in comments; edit your question to make it clearer and more complete.â Scott
Nov 5 '17 at 0:10
Now it is more clear. However, "I" is always uppercase on English. If I see next time an "i" from you, I won't fix your post, rather I will silently vote for "leave closed".
â peterh
Nov 5 '17 at 13:02
@roaima Not true, see here: unix.stackexchange.com/posts/402390/revisions He knew this rule very well. Btw, also you could give him a reopen vote, if you think the question deserves it.
â peterh
Nov 5 '17 at 13:44
@roaima Can't you simply write the solution in a comment? It would help a lot
â Escu Esculescu
Nov 5 '17 at 16:43
@roaima Did what you asked and reduced the script to the basic format by excluding unessential bits. Problem still remains. It's as if the script makes mydir and then ends without any errors or anything.
â Escu Esculescu
Nov 5 '17 at 17:09