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:
i'm still learning bash , i've been stumped on problem weeks. here's 2 scripts:./misc/clean.sh: line 31: syntax error: unexpected end of file
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:
================================================== ======
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.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
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
Post a Comment