Hello my issue is that I can't add the shebang to the first line when the application launches the nano editor. I am manually adding #!/bin/bash to the first line.
The code is here at github https://github.com/plutesci/Iwanttobash/blob/master/Icode_demo.bash
It seems to be this line, 1 ) nano $text.bash ; umask 022 $text.bash ;; This is part of a larger section of code.
selection=
until [ "$selection" = "0" ]; do
echo "
ICODE MENU
1 - Start a new Bash Script
2 - Make it Executable
3 - Run Bash Program
4 - Continue working on script
5 - start a new Python Idle
6 - Open a new shell
7 - Create Automatic Shell scripts
8 - Add a shebang
9 - Help
0 - exit program
"
echo -n "Enter selection: "
read selection
echo ""
case $selection in
1 ) nano $text.bash ; umask 022 $text.bash ;;
2 ) chmod 755 $text.bash ;;
3 ) gnome-terminal `./$text.bash` ;;
4 ) nano $text.bash ;;
5 ) idle ;;
6 ) gnome-terminal ;;
7 ) nano ;; # would be something like grep a special crafted document
8 ) cat > $text.bash | `#!/bin/bash` ;;
9 ) cat "icodehelp" ;;
0 ) exit ;;
* ) echo "Please enter 1, 2, 3, 4, 5, 6, 7, 8,9, or 0"
esac
done
I'm attempting to add #!/bin/bash to the app, when it opens new file with nano editor. I cant add images to this question, it is only a few lines of code, if you copy and paste the code and test it you will better understand the issue. just copy it and name it what you like and run it with ./Icode_demo.bash or name you choose.
I have tried this line change nano $text.bash ; cat "#!/bin/bash" >> $text.bash ;; and also this. nano $text.bash ; echo "#!/bin/bash" >> $text.bash ;;