menu working, but not with |bash command
below is a script that displays a menu, when I run it like ./menu.sh
it works, but when I run it like this: ./menu.sh | bash
I get a lot of commands not found.
The reason I want to run it with | bash
is because it will be on an ftp server and I need to run it from different remote locations. so I just do a curl -s
to the ftp and if i do not use the | bash
I just cat
a printout of the code
#!/bin/bash
#$path=./
while :
do
echo " "
echo " "
echo "===== MAIN - MENU ====="
echo "1. Run old sanity script"
echo "2. Asterisk"
echo "3. Audio"
echo "4. CoCo"
echo "5. Database"
echo "6. Mobile"
echo "7. SSH"
echo "8. Touch"
echo "9. VDS"
echo "10. Wireshark"
echo -----------------------
echo "q. Quit"
echo "r. Reload"
echo "======================="
echo -n "Please enter your choice: "
read opt;
echo " "
echo " "
case $opt in
1) curl -s sanity_check.sh | bash;;
2) exec ./menu/asterisk/menu.sh;;
3) exec ./menu/audio/menu.sh;;
4) exec ./menu/coco/menu.sh;;
5) exec ./menu/database/menu.sh;;
6) exec ./menu/mobile/menu.sh;;
7) exec ./menu/ssh/menu.sh;;
8) exec ./menu/touch/menu.sh;;
9) exec ./menu/vds/menu.sh;;
10) exec ./menu/wireshark/menu.sh;;
q) echo " "
echo "Bye Bye";
exit 1;;
Q) echo " "
echo "Bye Bye";
exit 1;;
r) exec ./menu.sh;;
R) exec ./menu.sh;;
*) echo "$opt is an invaild option.";
echo "Press [enter] key to continue. . .";
read enterKey;;
esac
done
it gives me the following errors:
bash: line 3: =====: command not found
bash: line 4: 1.: command not found
bash: line 5: 2.: command not found
bash: line 6: 3.: command not found
bash: line 7: 4.: command not found
bash: line 8: 5.: command not found
bash: line 9: 6.: command not found
bash: line 10: 7.: command not found
bash: line 11: 8.: command not found
bash: line 12: 9.: command not found
bash: line 13: 10.: command not found
bash: line 14: -----------------------: command not found
bash: line 15: q.: command not found
bash: line 16: r.: command not found
bash: line 17: =======================: command not found
but for me these are just the echo commands ..... or am I missing something
bash remote menu
add a comment |
below is a script that displays a menu, when I run it like ./menu.sh
it works, but when I run it like this: ./menu.sh | bash
I get a lot of commands not found.
The reason I want to run it with | bash
is because it will be on an ftp server and I need to run it from different remote locations. so I just do a curl -s
to the ftp and if i do not use the | bash
I just cat
a printout of the code
#!/bin/bash
#$path=./
while :
do
echo " "
echo " "
echo "===== MAIN - MENU ====="
echo "1. Run old sanity script"
echo "2. Asterisk"
echo "3. Audio"
echo "4. CoCo"
echo "5. Database"
echo "6. Mobile"
echo "7. SSH"
echo "8. Touch"
echo "9. VDS"
echo "10. Wireshark"
echo -----------------------
echo "q. Quit"
echo "r. Reload"
echo "======================="
echo -n "Please enter your choice: "
read opt;
echo " "
echo " "
case $opt in
1) curl -s sanity_check.sh | bash;;
2) exec ./menu/asterisk/menu.sh;;
3) exec ./menu/audio/menu.sh;;
4) exec ./menu/coco/menu.sh;;
5) exec ./menu/database/menu.sh;;
6) exec ./menu/mobile/menu.sh;;
7) exec ./menu/ssh/menu.sh;;
8) exec ./menu/touch/menu.sh;;
9) exec ./menu/vds/menu.sh;;
10) exec ./menu/wireshark/menu.sh;;
q) echo " "
echo "Bye Bye";
exit 1;;
Q) echo " "
echo "Bye Bye";
exit 1;;
r) exec ./menu.sh;;
R) exec ./menu.sh;;
*) echo "$opt is an invaild option.";
echo "Press [enter] key to continue. . .";
read enterKey;;
esac
done
it gives me the following errors:
bash: line 3: =====: command not found
bash: line 4: 1.: command not found
bash: line 5: 2.: command not found
bash: line 6: 3.: command not found
bash: line 7: 4.: command not found
bash: line 8: 5.: command not found
bash: line 9: 6.: command not found
bash: line 10: 7.: command not found
bash: line 11: 8.: command not found
bash: line 12: 9.: command not found
bash: line 13: 10.: command not found
bash: line 14: -----------------------: command not found
bash: line 15: q.: command not found
bash: line 16: r.: command not found
bash: line 17: =======================: command not found
but for me these are just the echo commands ..... or am I missing something
bash remote menu
add a comment |
below is a script that displays a menu, when I run it like ./menu.sh
it works, but when I run it like this: ./menu.sh | bash
I get a lot of commands not found.
The reason I want to run it with | bash
is because it will be on an ftp server and I need to run it from different remote locations. so I just do a curl -s
to the ftp and if i do not use the | bash
I just cat
a printout of the code
#!/bin/bash
#$path=./
while :
do
echo " "
echo " "
echo "===== MAIN - MENU ====="
echo "1. Run old sanity script"
echo "2. Asterisk"
echo "3. Audio"
echo "4. CoCo"
echo "5. Database"
echo "6. Mobile"
echo "7. SSH"
echo "8. Touch"
echo "9. VDS"
echo "10. Wireshark"
echo -----------------------
echo "q. Quit"
echo "r. Reload"
echo "======================="
echo -n "Please enter your choice: "
read opt;
echo " "
echo " "
case $opt in
1) curl -s sanity_check.sh | bash;;
2) exec ./menu/asterisk/menu.sh;;
3) exec ./menu/audio/menu.sh;;
4) exec ./menu/coco/menu.sh;;
5) exec ./menu/database/menu.sh;;
6) exec ./menu/mobile/menu.sh;;
7) exec ./menu/ssh/menu.sh;;
8) exec ./menu/touch/menu.sh;;
9) exec ./menu/vds/menu.sh;;
10) exec ./menu/wireshark/menu.sh;;
q) echo " "
echo "Bye Bye";
exit 1;;
Q) echo " "
echo "Bye Bye";
exit 1;;
r) exec ./menu.sh;;
R) exec ./menu.sh;;
*) echo "$opt is an invaild option.";
echo "Press [enter] key to continue. . .";
read enterKey;;
esac
done
it gives me the following errors:
bash: line 3: =====: command not found
bash: line 4: 1.: command not found
bash: line 5: 2.: command not found
bash: line 6: 3.: command not found
bash: line 7: 4.: command not found
bash: line 8: 5.: command not found
bash: line 9: 6.: command not found
bash: line 10: 7.: command not found
bash: line 11: 8.: command not found
bash: line 12: 9.: command not found
bash: line 13: 10.: command not found
bash: line 14: -----------------------: command not found
bash: line 15: q.: command not found
bash: line 16: r.: command not found
bash: line 17: =======================: command not found
but for me these are just the echo commands ..... or am I missing something
bash remote menu
below is a script that displays a menu, when I run it like ./menu.sh
it works, but when I run it like this: ./menu.sh | bash
I get a lot of commands not found.
The reason I want to run it with | bash
is because it will be on an ftp server and I need to run it from different remote locations. so I just do a curl -s
to the ftp and if i do not use the | bash
I just cat
a printout of the code
#!/bin/bash
#$path=./
while :
do
echo " "
echo " "
echo "===== MAIN - MENU ====="
echo "1. Run old sanity script"
echo "2. Asterisk"
echo "3. Audio"
echo "4. CoCo"
echo "5. Database"
echo "6. Mobile"
echo "7. SSH"
echo "8. Touch"
echo "9. VDS"
echo "10. Wireshark"
echo -----------------------
echo "q. Quit"
echo "r. Reload"
echo "======================="
echo -n "Please enter your choice: "
read opt;
echo " "
echo " "
case $opt in
1) curl -s sanity_check.sh | bash;;
2) exec ./menu/asterisk/menu.sh;;
3) exec ./menu/audio/menu.sh;;
4) exec ./menu/coco/menu.sh;;
5) exec ./menu/database/menu.sh;;
6) exec ./menu/mobile/menu.sh;;
7) exec ./menu/ssh/menu.sh;;
8) exec ./menu/touch/menu.sh;;
9) exec ./menu/vds/menu.sh;;
10) exec ./menu/wireshark/menu.sh;;
q) echo " "
echo "Bye Bye";
exit 1;;
Q) echo " "
echo "Bye Bye";
exit 1;;
r) exec ./menu.sh;;
R) exec ./menu.sh;;
*) echo "$opt is an invaild option.";
echo "Press [enter] key to continue. . .";
read enterKey;;
esac
done
it gives me the following errors:
bash: line 3: =====: command not found
bash: line 4: 1.: command not found
bash: line 5: 2.: command not found
bash: line 6: 3.: command not found
bash: line 7: 4.: command not found
bash: line 8: 5.: command not found
bash: line 9: 6.: command not found
bash: line 10: 7.: command not found
bash: line 11: 8.: command not found
bash: line 12: 9.: command not found
bash: line 13: 10.: command not found
bash: line 14: -----------------------: command not found
bash: line 15: q.: command not found
bash: line 16: r.: command not found
bash: line 17: =======================: command not found
but for me these are just the echo commands ..... or am I missing something
bash remote menu
bash remote menu
edited Dec 19 '18 at 11:26
GAD3R
25.4k1750107
25.4k1750107
asked Dec 19 '18 at 7:18
WingZero
385
385
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
When running this code, it will output a text menu. What you are doing with ./menu.sh | bash
is that you are feeding the menu into bash
for execution. In other words, you say to bash
, "please execute this menu". bash
does not know what any of the text in the menu means, so it throws errors.
However, this is not how you say you will use this script. You intend to fetch it (the script, not its output) and have it execute:
curl -o- 'ftp://.../menu.sh' | bash
This would not execute the script on the left hand side of the pipeline, while your ./menu.sh | bash
does. So what you are proposing would probably work.
Also note that it's a fair bit easier to do multi-line output with a here-document:
cat <<END_MENU
===== MAIN - MENU =====
1. Run old sanity script
2. Asterisk
3. Audio
4. CoCo
5. Database
6. Mobile
7. SSH
8. Touch
9. VDS
10. Wireshark
-----------------------
q. Quit
r. Reload
=======================
END_MENU
Also investigate the select
statement in bash
. It displays menus for you and makes it easier to do user input (unless you want special formatting of the menu and options, obviously).
You can also do multiple patterns in case
statements:
q|Q) echo 'Bye!'
exit ;;
or
[qQ]) echo 'Bye!'
exit ;;
(an exit
due to the user's request should probably not return a non-zero exit code, by the way)
thanks for the advice, the curl -o- option does not fully work, i still get a few errors... i am currently looking in to the select option, but again here, when i want to run it form the remote server using the | bash statement at the end i get errors.
– WingZero
Dec 19 '18 at 9:46
@WingZero huh? What error do you get?
– Kusalananda
Dec 19 '18 at 9:49
'bash: line 2: $'r': command not found bash: line 4: $'r': command not found bash: line 5: $'r': command not found bash: line 35: syntax error near unexpected token$'inr'' 'ash: line 35:
case $opt in'
– WingZero
Dec 19 '18 at 9:55
@WingZero This is because your script is a DOS text file. DOS text files has an extra carriage return character at the end of each line. Are you writing it on Windows?
– Kusalananda
Dec 19 '18 at 9:57
Hi,maybe it is easier to get the whole story: I've been a system admin for around 15 years now, always worked in windows environments. due to a job change one and a half years ago, i started working on linux systems. i am running ubuntu 18.10 atm, that is where i wrote my scripts (in visual studio code) i have a lot of scripts that i need to run on different systems that are in different locations.
– WingZero
Dec 19 '18 at 10:21
|
show 5 more comments
You are sending the output of the script to bash. don't you want to send the text of the script to bash to make bash execute it?
cat menu.sh | bash
hi, these scripts are on an ftp server. is there a way to cat with username and password?
– WingZero
Dec 19 '18 at 15:16
so i am still having issues with the |bash command at the end, i cant jus do an echo ...
– WingZero
Dec 19 '18 at 15:18
do you have an idea on how to do en echo command together with the bash command?
– WingZero
Dec 19 '18 at 15:18
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489845%2fmenu-working-but-not-with-bash-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
When running this code, it will output a text menu. What you are doing with ./menu.sh | bash
is that you are feeding the menu into bash
for execution. In other words, you say to bash
, "please execute this menu". bash
does not know what any of the text in the menu means, so it throws errors.
However, this is not how you say you will use this script. You intend to fetch it (the script, not its output) and have it execute:
curl -o- 'ftp://.../menu.sh' | bash
This would not execute the script on the left hand side of the pipeline, while your ./menu.sh | bash
does. So what you are proposing would probably work.
Also note that it's a fair bit easier to do multi-line output with a here-document:
cat <<END_MENU
===== MAIN - MENU =====
1. Run old sanity script
2. Asterisk
3. Audio
4. CoCo
5. Database
6. Mobile
7. SSH
8. Touch
9. VDS
10. Wireshark
-----------------------
q. Quit
r. Reload
=======================
END_MENU
Also investigate the select
statement in bash
. It displays menus for you and makes it easier to do user input (unless you want special formatting of the menu and options, obviously).
You can also do multiple patterns in case
statements:
q|Q) echo 'Bye!'
exit ;;
or
[qQ]) echo 'Bye!'
exit ;;
(an exit
due to the user's request should probably not return a non-zero exit code, by the way)
thanks for the advice, the curl -o- option does not fully work, i still get a few errors... i am currently looking in to the select option, but again here, when i want to run it form the remote server using the | bash statement at the end i get errors.
– WingZero
Dec 19 '18 at 9:46
@WingZero huh? What error do you get?
– Kusalananda
Dec 19 '18 at 9:49
'bash: line 2: $'r': command not found bash: line 4: $'r': command not found bash: line 5: $'r': command not found bash: line 35: syntax error near unexpected token$'inr'' 'ash: line 35:
case $opt in'
– WingZero
Dec 19 '18 at 9:55
@WingZero This is because your script is a DOS text file. DOS text files has an extra carriage return character at the end of each line. Are you writing it on Windows?
– Kusalananda
Dec 19 '18 at 9:57
Hi,maybe it is easier to get the whole story: I've been a system admin for around 15 years now, always worked in windows environments. due to a job change one and a half years ago, i started working on linux systems. i am running ubuntu 18.10 atm, that is where i wrote my scripts (in visual studio code) i have a lot of scripts that i need to run on different systems that are in different locations.
– WingZero
Dec 19 '18 at 10:21
|
show 5 more comments
When running this code, it will output a text menu. What you are doing with ./menu.sh | bash
is that you are feeding the menu into bash
for execution. In other words, you say to bash
, "please execute this menu". bash
does not know what any of the text in the menu means, so it throws errors.
However, this is not how you say you will use this script. You intend to fetch it (the script, not its output) and have it execute:
curl -o- 'ftp://.../menu.sh' | bash
This would not execute the script on the left hand side of the pipeline, while your ./menu.sh | bash
does. So what you are proposing would probably work.
Also note that it's a fair bit easier to do multi-line output with a here-document:
cat <<END_MENU
===== MAIN - MENU =====
1. Run old sanity script
2. Asterisk
3. Audio
4. CoCo
5. Database
6. Mobile
7. SSH
8. Touch
9. VDS
10. Wireshark
-----------------------
q. Quit
r. Reload
=======================
END_MENU
Also investigate the select
statement in bash
. It displays menus for you and makes it easier to do user input (unless you want special formatting of the menu and options, obviously).
You can also do multiple patterns in case
statements:
q|Q) echo 'Bye!'
exit ;;
or
[qQ]) echo 'Bye!'
exit ;;
(an exit
due to the user's request should probably not return a non-zero exit code, by the way)
thanks for the advice, the curl -o- option does not fully work, i still get a few errors... i am currently looking in to the select option, but again here, when i want to run it form the remote server using the | bash statement at the end i get errors.
– WingZero
Dec 19 '18 at 9:46
@WingZero huh? What error do you get?
– Kusalananda
Dec 19 '18 at 9:49
'bash: line 2: $'r': command not found bash: line 4: $'r': command not found bash: line 5: $'r': command not found bash: line 35: syntax error near unexpected token$'inr'' 'ash: line 35:
case $opt in'
– WingZero
Dec 19 '18 at 9:55
@WingZero This is because your script is a DOS text file. DOS text files has an extra carriage return character at the end of each line. Are you writing it on Windows?
– Kusalananda
Dec 19 '18 at 9:57
Hi,maybe it is easier to get the whole story: I've been a system admin for around 15 years now, always worked in windows environments. due to a job change one and a half years ago, i started working on linux systems. i am running ubuntu 18.10 atm, that is where i wrote my scripts (in visual studio code) i have a lot of scripts that i need to run on different systems that are in different locations.
– WingZero
Dec 19 '18 at 10:21
|
show 5 more comments
When running this code, it will output a text menu. What you are doing with ./menu.sh | bash
is that you are feeding the menu into bash
for execution. In other words, you say to bash
, "please execute this menu". bash
does not know what any of the text in the menu means, so it throws errors.
However, this is not how you say you will use this script. You intend to fetch it (the script, not its output) and have it execute:
curl -o- 'ftp://.../menu.sh' | bash
This would not execute the script on the left hand side of the pipeline, while your ./menu.sh | bash
does. So what you are proposing would probably work.
Also note that it's a fair bit easier to do multi-line output with a here-document:
cat <<END_MENU
===== MAIN - MENU =====
1. Run old sanity script
2. Asterisk
3. Audio
4. CoCo
5. Database
6. Mobile
7. SSH
8. Touch
9. VDS
10. Wireshark
-----------------------
q. Quit
r. Reload
=======================
END_MENU
Also investigate the select
statement in bash
. It displays menus for you and makes it easier to do user input (unless you want special formatting of the menu and options, obviously).
You can also do multiple patterns in case
statements:
q|Q) echo 'Bye!'
exit ;;
or
[qQ]) echo 'Bye!'
exit ;;
(an exit
due to the user's request should probably not return a non-zero exit code, by the way)
When running this code, it will output a text menu. What you are doing with ./menu.sh | bash
is that you are feeding the menu into bash
for execution. In other words, you say to bash
, "please execute this menu". bash
does not know what any of the text in the menu means, so it throws errors.
However, this is not how you say you will use this script. You intend to fetch it (the script, not its output) and have it execute:
curl -o- 'ftp://.../menu.sh' | bash
This would not execute the script on the left hand side of the pipeline, while your ./menu.sh | bash
does. So what you are proposing would probably work.
Also note that it's a fair bit easier to do multi-line output with a here-document:
cat <<END_MENU
===== MAIN - MENU =====
1. Run old sanity script
2. Asterisk
3. Audio
4. CoCo
5. Database
6. Mobile
7. SSH
8. Touch
9. VDS
10. Wireshark
-----------------------
q. Quit
r. Reload
=======================
END_MENU
Also investigate the select
statement in bash
. It displays menus for you and makes it easier to do user input (unless you want special formatting of the menu and options, obviously).
You can also do multiple patterns in case
statements:
q|Q) echo 'Bye!'
exit ;;
or
[qQ]) echo 'Bye!'
exit ;;
(an exit
due to the user's request should probably not return a non-zero exit code, by the way)
edited Dec 19 '18 at 7:44
answered Dec 19 '18 at 7:35
Kusalananda
121k16229372
121k16229372
thanks for the advice, the curl -o- option does not fully work, i still get a few errors... i am currently looking in to the select option, but again here, when i want to run it form the remote server using the | bash statement at the end i get errors.
– WingZero
Dec 19 '18 at 9:46
@WingZero huh? What error do you get?
– Kusalananda
Dec 19 '18 at 9:49
'bash: line 2: $'r': command not found bash: line 4: $'r': command not found bash: line 5: $'r': command not found bash: line 35: syntax error near unexpected token$'inr'' 'ash: line 35:
case $opt in'
– WingZero
Dec 19 '18 at 9:55
@WingZero This is because your script is a DOS text file. DOS text files has an extra carriage return character at the end of each line. Are you writing it on Windows?
– Kusalananda
Dec 19 '18 at 9:57
Hi,maybe it is easier to get the whole story: I've been a system admin for around 15 years now, always worked in windows environments. due to a job change one and a half years ago, i started working on linux systems. i am running ubuntu 18.10 atm, that is where i wrote my scripts (in visual studio code) i have a lot of scripts that i need to run on different systems that are in different locations.
– WingZero
Dec 19 '18 at 10:21
|
show 5 more comments
thanks for the advice, the curl -o- option does not fully work, i still get a few errors... i am currently looking in to the select option, but again here, when i want to run it form the remote server using the | bash statement at the end i get errors.
– WingZero
Dec 19 '18 at 9:46
@WingZero huh? What error do you get?
– Kusalananda
Dec 19 '18 at 9:49
'bash: line 2: $'r': command not found bash: line 4: $'r': command not found bash: line 5: $'r': command not found bash: line 35: syntax error near unexpected token$'inr'' 'ash: line 35:
case $opt in'
– WingZero
Dec 19 '18 at 9:55
@WingZero This is because your script is a DOS text file. DOS text files has an extra carriage return character at the end of each line. Are you writing it on Windows?
– Kusalananda
Dec 19 '18 at 9:57
Hi,maybe it is easier to get the whole story: I've been a system admin for around 15 years now, always worked in windows environments. due to a job change one and a half years ago, i started working on linux systems. i am running ubuntu 18.10 atm, that is where i wrote my scripts (in visual studio code) i have a lot of scripts that i need to run on different systems that are in different locations.
– WingZero
Dec 19 '18 at 10:21
thanks for the advice, the curl -o- option does not fully work, i still get a few errors... i am currently looking in to the select option, but again here, when i want to run it form the remote server using the | bash statement at the end i get errors.
– WingZero
Dec 19 '18 at 9:46
thanks for the advice, the curl -o- option does not fully work, i still get a few errors... i am currently looking in to the select option, but again here, when i want to run it form the remote server using the | bash statement at the end i get errors.
– WingZero
Dec 19 '18 at 9:46
@WingZero huh? What error do you get?
– Kusalananda
Dec 19 '18 at 9:49
@WingZero huh? What error do you get?
– Kusalananda
Dec 19 '18 at 9:49
'bash: line 2: $'r': command not found bash: line 4: $'r': command not found bash: line 5: $'r': command not found bash: line 35: syntax error near unexpected token
$'inr'' 'ash: line 35:
case $opt in'– WingZero
Dec 19 '18 at 9:55
'bash: line 2: $'r': command not found bash: line 4: $'r': command not found bash: line 5: $'r': command not found bash: line 35: syntax error near unexpected token
$'inr'' 'ash: line 35:
case $opt in'– WingZero
Dec 19 '18 at 9:55
@WingZero This is because your script is a DOS text file. DOS text files has an extra carriage return character at the end of each line. Are you writing it on Windows?
– Kusalananda
Dec 19 '18 at 9:57
@WingZero This is because your script is a DOS text file. DOS text files has an extra carriage return character at the end of each line. Are you writing it on Windows?
– Kusalananda
Dec 19 '18 at 9:57
Hi,maybe it is easier to get the whole story: I've been a system admin for around 15 years now, always worked in windows environments. due to a job change one and a half years ago, i started working on linux systems. i am running ubuntu 18.10 atm, that is where i wrote my scripts (in visual studio code) i have a lot of scripts that i need to run on different systems that are in different locations.
– WingZero
Dec 19 '18 at 10:21
Hi,maybe it is easier to get the whole story: I've been a system admin for around 15 years now, always worked in windows environments. due to a job change one and a half years ago, i started working on linux systems. i am running ubuntu 18.10 atm, that is where i wrote my scripts (in visual studio code) i have a lot of scripts that i need to run on different systems that are in different locations.
– WingZero
Dec 19 '18 at 10:21
|
show 5 more comments
You are sending the output of the script to bash. don't you want to send the text of the script to bash to make bash execute it?
cat menu.sh | bash
hi, these scripts are on an ftp server. is there a way to cat with username and password?
– WingZero
Dec 19 '18 at 15:16
so i am still having issues with the |bash command at the end, i cant jus do an echo ...
– WingZero
Dec 19 '18 at 15:18
do you have an idea on how to do en echo command together with the bash command?
– WingZero
Dec 19 '18 at 15:18
add a comment |
You are sending the output of the script to bash. don't you want to send the text of the script to bash to make bash execute it?
cat menu.sh | bash
hi, these scripts are on an ftp server. is there a way to cat with username and password?
– WingZero
Dec 19 '18 at 15:16
so i am still having issues with the |bash command at the end, i cant jus do an echo ...
– WingZero
Dec 19 '18 at 15:18
do you have an idea on how to do en echo command together with the bash command?
– WingZero
Dec 19 '18 at 15:18
add a comment |
You are sending the output of the script to bash. don't you want to send the text of the script to bash to make bash execute it?
cat menu.sh | bash
You are sending the output of the script to bash. don't you want to send the text of the script to bash to make bash execute it?
cat menu.sh | bash
answered Dec 19 '18 at 7:35
koongfoopoodle
262
262
hi, these scripts are on an ftp server. is there a way to cat with username and password?
– WingZero
Dec 19 '18 at 15:16
so i am still having issues with the |bash command at the end, i cant jus do an echo ...
– WingZero
Dec 19 '18 at 15:18
do you have an idea on how to do en echo command together with the bash command?
– WingZero
Dec 19 '18 at 15:18
add a comment |
hi, these scripts are on an ftp server. is there a way to cat with username and password?
– WingZero
Dec 19 '18 at 15:16
so i am still having issues with the |bash command at the end, i cant jus do an echo ...
– WingZero
Dec 19 '18 at 15:18
do you have an idea on how to do en echo command together with the bash command?
– WingZero
Dec 19 '18 at 15:18
hi, these scripts are on an ftp server. is there a way to cat with username and password?
– WingZero
Dec 19 '18 at 15:16
hi, these scripts are on an ftp server. is there a way to cat with username and password?
– WingZero
Dec 19 '18 at 15:16
so i am still having issues with the |bash command at the end, i cant jus do an echo ...
– WingZero
Dec 19 '18 at 15:18
so i am still having issues with the |bash command at the end, i cant jus do an echo ...
– WingZero
Dec 19 '18 at 15:18
do you have an idea on how to do en echo command together with the bash command?
– WingZero
Dec 19 '18 at 15:18
do you have an idea on how to do en echo command together with the bash command?
– WingZero
Dec 19 '18 at 15:18
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489845%2fmenu-working-but-not-with-bash-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown