cat command inside shell script closes the script shell and not execute
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
#!/bin/bash
clean_fun()
sed 's/^#.*$//g' $pathfile > /tmp/arg
echo -e "insert file name: nfile path will be $HOME/Desktop/filename."
read name
sed '/^$/d' /tmp/arg > /home/da7id/Desktop/"$name"
clear
echo
echo "insert pathfile [within single quotes] you want hashtag lines cleaned:"
read pathfile
pathfile=$(echo "$pathfile:1:$#pathfile-2")
clean_fun $pathfile
echo "do you want to see source-code of this script? [y/n]"
read a
if [[ "$a" -eq y ]]
then
cat /home/da7id/scripts_alias_folder/delete_#lines_copy.sh
fi
I have done this script. the first part is working fine but when it asks for print the source-code of the script and the cat command comes in the shell crashes and closes.
I've been googling a lot but didn't find an explanation.
can you help me?
shell-script scripting cat
add a comment |Â
up vote
0
down vote
favorite
#!/bin/bash
clean_fun()
sed 's/^#.*$//g' $pathfile > /tmp/arg
echo -e "insert file name: nfile path will be $HOME/Desktop/filename."
read name
sed '/^$/d' /tmp/arg > /home/da7id/Desktop/"$name"
clear
echo
echo "insert pathfile [within single quotes] you want hashtag lines cleaned:"
read pathfile
pathfile=$(echo "$pathfile:1:$#pathfile-2")
clean_fun $pathfile
echo "do you want to see source-code of this script? [y/n]"
read a
if [[ "$a" -eq y ]]
then
cat /home/da7id/scripts_alias_folder/delete_#lines_copy.sh
fi
I have done this script. the first part is working fine but when it asks for print the source-code of the script and the cat command comes in the shell crashes and closes.
I've been googling a lot but didn't find an explanation.
can you help me?
shell-script scripting cat
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
#!/bin/bash
clean_fun()
sed 's/^#.*$//g' $pathfile > /tmp/arg
echo -e "insert file name: nfile path will be $HOME/Desktop/filename."
read name
sed '/^$/d' /tmp/arg > /home/da7id/Desktop/"$name"
clear
echo
echo "insert pathfile [within single quotes] you want hashtag lines cleaned:"
read pathfile
pathfile=$(echo "$pathfile:1:$#pathfile-2")
clean_fun $pathfile
echo "do you want to see source-code of this script? [y/n]"
read a
if [[ "$a" -eq y ]]
then
cat /home/da7id/scripts_alias_folder/delete_#lines_copy.sh
fi
I have done this script. the first part is working fine but when it asks for print the source-code of the script and the cat command comes in the shell crashes and closes.
I've been googling a lot but didn't find an explanation.
can you help me?
shell-script scripting cat
#!/bin/bash
clean_fun()
sed 's/^#.*$//g' $pathfile > /tmp/arg
echo -e "insert file name: nfile path will be $HOME/Desktop/filename."
read name
sed '/^$/d' /tmp/arg > /home/da7id/Desktop/"$name"
clear
echo
echo "insert pathfile [within single quotes] you want hashtag lines cleaned:"
read pathfile
pathfile=$(echo "$pathfile:1:$#pathfile-2")
clean_fun $pathfile
echo "do you want to see source-code of this script? [y/n]"
read a
if [[ "$a" -eq y ]]
then
cat /home/da7id/scripts_alias_folder/delete_#lines_copy.sh
fi
I have done this script. the first part is working fine but when it asks for print the source-code of the script and the cat command comes in the shell crashes and closes.
I've been googling a lot but didn't find an explanation.
can you help me?
shell-script scripting cat
shell-script scripting cat
edited 3 mins ago
asked 9 mins ago
pietro letti
9617
9617
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f479525%2fcat-command-inside-shell-script-closes-the-script-shell-and-not-execute%23new-answer', 'question_page');
);
Post as a guest
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
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
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