Mount doesn't work in script [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash 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.







share|improve this 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 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










  • @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















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.







share|improve this 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 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










  • @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













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.







share|improve this question














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.









share|improve this question













share|improve this question




share|improve this question








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 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










  • @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




    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










  • @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
















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay