Bash Script Help PLEASE
checking is $num is an integer
read $num if [[ $num =~ ^[0-9] ]]; then echo "is integer" else echo "not interger" fi What wrong with this please help?? |
Hi, welcome to LQ!
Quote:
That said, the regex is wrong, too, because it would flag 12abc as an integer... you really want something like ^[0-9]+$ Cheers, Tink |
Quote:
|
Thanks
Thanks so much guys!!
This is due in about 6hours and i need to make it perfect. Please help me on this again guys. My teacher has a program that will be run to test my program. Therefor i can't use read to make the user input the arguments. Can you please help me and also see what else i can do to make this better. Thanks Guys. Ohh and we are limited to using the following: 1) test 2) printf 3) echo 4) sleep 5) expr 6) exit 7) basename 8) readonly 9) grep im so screwed arnt i? ---------- Post added 04-29-11 at 06:46 PM ---------- Code:
#################################################################### |
When posting code wrap it in CODE tags.
bash scripts will take arguments passed from the command line. See section "3.2.5. Special parameters" at http://tldp.org/LDP/Bash-Beginners-G...tml#sect_03_02 |
Welcome to LQ. Hope your time here helps you as much as mine has helped me.
Amplifying arizonagroovejet's (righteous) request: Please put code, command line output, config files, etc. inside [CODE] tags, aka "Code:" blocks. It will make your posts easier to read, & that will get you more, faster, better answers. -- Help us help you. BTW, You can edit your post(s) to do this retroactively. Also, please read or re-read the LQ Rules, paying especial note to: Quote:
Thank you, & again, welcome. |
Quote:
|
Thanks
Thanks heap for the help guys.
I'm looking for a programming tutor as im so far behind in my Diploma. Can anyone push me in the right direction? My teacher is incredibly smart as a programmer but he sucks as a teacher. I need help with my bash and also Java and C++. I cant find anything legit on programming tutors though i'm willing to pay anyone that has the time and can help me. Thanks again guys! p.s. so glad i found this forum. |
The bash guide I referred you to would help. Also the advanced bash scripting guide http://tldp.org/LDP/abs/html/tests.html
If you're looking for a tutor it might help if you provided your location, though the chances of anyone here being close enough to help seem slim. You could look for a local Linux Users Group. You could also try telling your teacher that you are having trouble, they might have contacts who could provide additional tutoring or be able to provide it themselves. If your teacher really does suck as a teacher, (as opposed to it being just you who thinks they do), then you won't be the only one having trouble with courses they teach and you and the other students could get together and raise this with the relevant authority. |
Hi,
Welcome to LQ! Quote:
Linux General Help, Tutorials & Programming General & WEB sections of SlackwareŽ-Links may be of some help. Just a few links to aid you to gaining some understanding; 1 Linux Documentation Project 2 Rute Tutorial & Exposition 3 Linux Command Guide 4 Bash Beginners Guide 5 Bash Reference Manual 6 Advanced Bash-Scripting Guide 7 Linux Newbie Admin Guide 8 LinuxSelfHelp 9 Utimate Linux Newbie Guide 10 Linux Home Networking 11 Virtualiation- Top 10 The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links! |
Help
Quote:
ofcourse the admin were very protective of their teacher and they brushed it off. Since then, myself and a couple of the other students have resorted to youtube tutorials to get the teacher we need. In saying that, we have passed all that basic tutorials can really teach us and need more. Thank you for your help once again and i guess its just up to me to figure it all out from here. . Cheers. |
"I sent a partition around the class..." & not the entire hard drive, quite a feat! :)
Seriously, I assume you meant "petition". -- You can edit your post to correct the spelling, if you like. BTW, good luck w/ getting a better teacher. I have 2ce, that I can still remember after 40 years, been stuck in a similar situation; neither ended well. |
All times are GMT -5. The time now is 06:40 AM. |