Getopts & eval help pls
hi im trying to use getopts to learn the variation of ways to create a small script in linux however i get a syntax error when i try to run my script:
-line 25 syntax error: unexpected end of file what do i need to put in or what am i doing wrong? Code:
#!/bin/bash |
omg
waw my god im starting to get addicted to linux ... WTF?! xD
after so much cursing to this OS and hours i passed after its rly getting fun doing it Okay i found the code by myself BUT if you guys wanne try to solve it then you may not look down untill you solved it yourself :P NO peeking!!! Peeking == Cheating!! if [ peeking=cheating ] then echo "you cheater!" However if you found an easier way to do it pls post below. it's a start in linux in how to make a small script shell program. quite usefull Congratsulations you just cheated ! :P #!/bin/bash opt1="" opt2="" opt3="" while getopts "ab" opt; do case $opt in a) opt1=" find / -type f -name *txt " ;; b) opt2=" 2>/dev/null " ;; esac done opt3="$opt1""$opt2" eval "$opt3" |
Quote:
Code:
function howto() { echo "Bash scripting guides: Quote:
Here's just correcting general wrongness and b0rkage: Code:
#!/bin/bash ...but I think you want something more like: Code:
#!/bin/bash |
All times are GMT -5. The time now is 08:24 AM. |