Skip to main content

Thread: Strange bugs with my program (Bash)


i'm having 2 strange bugs program wrote in bash. i'll start program, call script, return first script , weird reason first script display correct text have corresponding options (if press 1 it'll ever 1 corresponds in previous script) of previous script launched. that's first bug. second error when trying launch script 2:

./misc/clean.sh: line 31: syntax error: unexpected end of file
i'm still learning bash , i've been stumped on problem weeks. here's 2 scripts:

script 1:

code:
#!/bin/bash  clear    echo "gisah on"; uname -o  # =============================================  function  clean_hdd {     ./misc/clean.sh; }  function self-clean {     ./misc/self_clean.sh; }  function  exit {     break; }  select choice in \     "clean hard-disk" \     "self-cleaning" \     "power menu" \     "exit"     case $choice in         "clean hard-disk")             clean_hdd;             ;;         "self-cleaning")             self-clean;             ;;         "power menu")             main_menu;             ;;         "exit")             break;     exit             ;;         *)             echo "please select option";             ;;     esac done
================================================== ======
script 2:
================================================== ======
code:
#! /bin/bash  clear  function  firefox {     echo "firefox"; }  function main {        select choice in \     "firefox" \     "main menu"          case $choice in         "firefox")             rm -r ~/.mozilla/firefox/*.default/cache/;      cd ~/.mozilla/firefox/*.default/;     mkdir ./cache;             ;;     "main menu")     cd ~/desktop/gisah_bash/;     ./gisah.sh ;;     esac done
here's how reproduce bug, save , name first script "gisah.sh" (name of program) , chmod +x it, launch it. press 1 call second script. you'll second error mentioned. if can fix let me know i'd appreciate it. had fixed once screwed while diagnosing first problem mentioned. then, when script gets launched, go previous menu pressing 2.

need help. thanks!

./misc/clean.sh: line 31: syntax error: unexpected end of file - forgot close bracket-)

rest - believed whole problem because - use script parameter 2. , first script waits end of second, because management passed him.

if want run scripts keyboard, think - need use ыгиscripts invoked without parameter, defining functionality.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Strange bugs with my program (Bash)


Ubuntu

Comments

Popular posts from this blog

how to devide a circle into equal parts

"Could not fill because there are not enough opaque source pixels" - not solved by any other thread

Why can't I change the billing info for my account?