473,322 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Help on Bash Scripting

keyvanrahmadi
Hello there guys,

i think i am at the end of this, which i have to edmit has been a huge learning curve for me, but i still have couple of problems, which i was hoping you can help me. I think tbh its a very simple thing which i am over looking and just require a pair of fresh eyes to look at. I greatly appriciate if you could have a look at the script and let me know what you think. if you have any solution, or advise just email me or pm here..

player 1 option scripts:


Expand|Select|Wrap|Line Numbers
  1. #!/bin/bash
  2.  
  3. function stored_word()
  4. {
  5.   case $(( $$ % 8 )) in
  6.     0 ) echo "energy"    ;;  1 ) echo "touch" ;;
  7.     2 ) echo "climbing" ;; 3 ) echo "declare" ;;
  8.     4 ) echo "marry"  ;;    5 ) echo "relax"   ;;
  9.     6 ) echo "bugs"     ;;    7 ) echo "inaccessible" ;;
  10.   esac
  11. }
  12.  
  13. function startup() {
  14.  
  15. echo "Choose number of Players:"
  16. read players
  17.  
  18. if [ $players -eq 1 ] ; then
  19.         echo " A Random word has been chosen... Enjoy the Game"
  20. elif [ $players -eq 2 ] ; then
  21.         echo "choose a word for player two to guess:"
  22.         read player2word
  23. else
  24.         echo "incorrect option..."
  25.         replay
  26. fi
  27. }
  28.  
  29. function replay() {
  30.  
  31. echo " Do you wish to play again? TYPE \"y\" to play again or \"n\" to quit"
  32. read choice
  33.  
  34. if [ $choice == y ] ; then
  35. startup
  36. else
  37. echo "Hope you enjoyed the game"
  38. exit 0
  39. fi
  40. }
  41.  
  42. startup
  43. life=10
  44. word=$(stored_word)
  45. letters=$(echo $word | wc -c)
  46. letters=$(( $letters - 1 ))
  47. template="$(echo $word | tr '[a-z A-Z 0-9]' '.')"
  48. remaining=$letters
  49.  
  50. echo "  ****The word you are trying to guess has \"$letters\" letters ****"
  51.  
  52. while [ $template != $word ] ; do
  53.         echo""
  54.         echo -n "Word is: $template Please choose a Letter: " ;
  55.         read guess
  56.          guesses=$(( $guesses + 1 ))
  57.          echo " you have chosen $guess"
  58.      if echo $guessed | grep -i $guess > .temp1 ; then
  59.          echo "You've already guessed that letter. Try again!"
  60.         guessed="$guessed$guess"
  61.         echo $letter
  62.      elif ! echo $word | grep -i $guess > .temp1 ; then
  63.          echo "Sorry, the letter \"$guess\" is not in the word."
  64.          guessed="$guessed$guess"
  65.          badguesses=$(( $badguesses + 1))
  66.          echo "$guessed"
  67.          life=$(( $life -1 ))
  68.          echo " you have $life life left"
  69.      else
  70.           echo "Good going! The letter $guess is in the word!"
  71.           guessed="$guessed$guess"
  72.           echo $letter
  73.      fi
  74.  
  75. if [ $life == 0 ]; then
  76.         echo "THE WORD YOU WERE TRYING TO GUESS WAS \"$word\""
  77.         replay
  78.         exit 0
  79.  
  80. fi
  81.  
  82.       lettercount=0
  83.       template2=""
  84.       while [ $lettercount != $(( $letters )) ] ; do
  85.           val1=${word:lettercount:1}
  86.  val2=${template:lettercount:1}
  87.   if [ "$val1" == "$guess" ] ; then
  88.           template2="$template2$guess"
  89.           elif [ "$val2" != '.' ] ; then
  90.           template2="$template2$val2"
  91.           else
  92.           template2="$template2."
  93.           fi
  94.           lettercount=$(( $lettercount + 1 ))
  95.       done
  96.       template=$template2
  97. done
  98.  
  99. echo -n "Congratulations! You guessed \"$word\" in \"$guesses\" guesses"
  100. echo " with $badguesses incorrect guesses"
  101. replay
  102. exit 0
  103.  
The problem is when asked if you want to play again, when you say yes, it kicks out of the script after printing the followig line:

Expand|Select|Wrap|Line Numbers
  1. echo " A Random word has been chosen... Enjoy the Game"
  2.  

player 2 option scripts:


Expand|Select|Wrap|Line Numbers
  1. startup
  2.  
  3. life=10
  4. word=$player2word
  5.  
Thats the only line which is different everything else is the same . The script again kicks out after it has asked you choose a word for player 2 to guess, during replay.

I created 3 function:

1- stored_words: words used for 1-player game.
2- Replay
3- Startup

so to sumerise and stop boring a hell out of you, the problems are:

1- the looping so the players can continue if they decide to play again.

2- combine both scripts into one

K
May 21 '07 #1
17 1626
arne
315 Expert 100+
so to sumerise and stop boring a hell out of you, the problems are:
1- the looping so the players can continue if they decide to play again.
The problem is that there is no loop. You just ask for a replay,
if 'y' then you call startup, but all 'startup' does is to print the
line you see :-)

Try to put a loop around your game which exits when the
answer is not 'y'. This should help.

HTH,
arne
May 21 '07 #2
The problem is that there is no loop. You just ask for a replay,
if 'y' then you call startup, but all 'startup' does is to print the
line you see :-)

Try to put a loop around your game which exits when the
answer is not 'y'. This should help.

HTH,
arne
tbh i am not sure i understand what you mean.. i thought as startup is a function, it will get called up when its mentioned and should run... and if there is a loop which exist when the answer is not 'y', surely that will just end the game??

am i being really thick here?

K
May 21 '07 #3
arne
315 Expert 100+
tbh i am not sure i understand what you mean.. i thought as startup is a function, it will get called up when its mentioned and should run... and if there is a loop which exist when the answer is not 'y', surely that will just end the game??

am i being really thick here?

K
Sorry, if I wasn't clear.

If you call replay in line 101, it will call startup, which will print and return. The program will exit afterwards (which is probably not what you want). Depending on the return code of startup, you should jump back to line 43 in order to repeat the game. This is usually done by a loop.

arne
May 21 '07 #4
Sorry, if I wasn't clear.

If you call replay in line 101, it will call startup, which will print and return. The program will exit afterwards (which is probably not what you want). Depending on the return code of startup, you should jump back to line 43 in order to repeat the game. This is usually done by a loop.

arne
I am not sure about how i can find the return code of startup.. but am i correct this is what you mean, instead of having replay at the end of the scrip have:

Expand|Select|Wrap|Line Numbers
  1.  
  2. echo " to play again press 'y' or 'n' to exit"
  3. read choice
  4.  
  5. while [ $choice == y ] ; do
  6. startup
  7. else
  8. exit 0
  9. done
  10.  
  11.  
I am sure my while statement is incorrect, but is that what you meant?

K
May 21 '07 #5
arne
315 Expert 100+
I am not sure about how i can find the return code of startup.. but am i correct this is what you mean, instead of having replay at the end of the scrip have:

Expand|Select|Wrap|Line Numbers
  1.  
  2. echo " to play again press 'y' or 'n' to exit"
  3. read choice
  4.  
  5. while [ $choice == y ] ; do
  6. startup
  7. else
  8. exit 0
  9. done
  10.  
  11.  
I am sure my while statement is incorrect, but is that what you meant?

K
No, what I meant was:
Expand|Select|Wrap|Line Numbers
  1.       #!/bin/bash
  2.  
  3.       function stored_word()
  4.  
  5.       {
  6.  
  7.       case $(( $$ % 8 )) in
  8.  
  9.           0 ) echo "energy"    ;;  1 ) echo "touch" ;;
  10.  
  11.           2 ) echo "climbing" ;; 3 ) echo "declare" ;;
  12.  
  13.           4 ) echo "marry"  ;;    5 ) echo "relax"   ;;
  14.  
  15.           6 ) echo "bugs"     ;;    7 ) echo "inaccessible" ;;
  16.  
  17.       esac
  18.  
  19.       }
  20.  
  21.  
  22.  
  23.       function startup() {
  24.  
  25.       echo "Choose number of Players:"
  26.  
  27.       read players
  28.  
  29.       if [ $players -eq 1 ] ; then
  30.  
  31.               echo " A Random word has been chosen... Enjoy the Game"
  32.  
  33.       elif [ $players -eq 2 ] ; then
  34.  
  35.               echo "choose a word for player two to guess:"
  36.  
  37.               read player2word
  38.  
  39.       else
  40.  
  41.               echo "incorrect option..."
  42.  
  43.               replay
  44.  
  45.       fi
  46.  
  47.       }
  48.  
  49.       function replay() {
  50.  
  51.       echo " Do you wish to play again? TYPE \"y\" to play again or \"n\" to quit"
  52.  
  53.       read choice
  54.  
  55.       if [ $choice == y ] ; then
  56.  
  57.           echo 
  58.  
  59.       else
  60.  
  61.           echo "Hope you enjoyed the game"
  62.  
  63.           exit 0
  64.  
  65.       fi
  66.  
  67.       }
  68.  
  69.  
  70.       choice="y"
  71.  
  72.       while [ $choice == y ]; do 
  73.  
  74.       startup      
  75.  
  76.       life=10
  77.  
  78.       word=$(stored_word)
  79.  
  80.       letters=$(echo $word | wc -c)
  81.  
  82.       letters=$(( $letters - 1 ))
  83.  
  84.       template="$(echo $word | tr '[a-z A-Z 0-9]' '.')"
  85.  
  86.       remaining=$letters
  87.  
  88.  
  89.  
  90.       echo "  ****The word you are trying to guess has \"$letters\" letters ****"
  91.  
  92.  
  93.  
  94.       while [ $template != $word ] ; do
  95.  
  96.           echo""
  97.  
  98.       echo -n "Word is: $template Please choose a Letter: " ;
  99.  
  100.       read guess
  101.  
  102.       guesses=$(( $guesses + 1 ))
  103.  
  104.       echo " you have chosen $guess"
  105.  
  106.       if echo $guessed | grep -i $guess > .temp1 ; then
  107.  
  108.           echo "You've already guessed that letter. Try again!"
  109.  
  110.           guessed="$guessed$guess"
  111.  
  112.           echo $letter
  113.  
  114.       elif ! echo $word | grep -i $guess > .temp1 ; then
  115.  
  116.           echo "Sorry, the letter \"$guess\" is not in the word."
  117.  
  118.           guessed="$guessed$guess"
  119.  
  120.           badguesses=$(( $badguesses + 1))
  121.  
  122.           echo "$guessed"
  123.  
  124.           life=$(( $life -1 ))
  125.  
  126.           echo " you have $life life left"
  127.  
  128.       else
  129.  
  130.           echo "Good going! The letter $guess is in the word!"
  131.  
  132.           guessed="$guessed$guess"
  133.  
  134.           echo $letter
  135.  
  136.       fi
  137.  
  138.  
  139.  
  140.       if [ $life == 0 ]; then
  141.  
  142.           echo "THE WORD YOU WERE TRYING TO GUESS WAS \"$word\""
  143.  
  144.           replay
  145.  
  146.           exit 0
  147.  
  148.  
  149.  
  150.       fi
  151.  
  152.  
  153.  
  154.       lettercount=0
  155.  
  156.       template2=""
  157.  
  158.       while [ $lettercount != $(( $letters )) ] ; do
  159.  
  160.           val1=${word:lettercount:1}
  161.  
  162.           val2=${template:lettercount:1}
  163.  
  164.           if [ "$val1" == "$guess" ] ; then
  165.  
  166.           template2="$template2$guess"
  167.  
  168.           elif [ "$val2" != '.' ] ; then
  169.  
  170.           template2="$template2$val2"
  171.  
  172.           else
  173.  
  174.           template2="$template2."
  175.  
  176.           fi
  177.  
  178.           lettercount=$(( $lettercount + 1 ))
  179.  
  180.       done
  181.  
  182.       template=$template2
  183.  
  184.       done
  185.  
  186.  
  187.  
  188.       echo -n "Congratulations! You guessed \"$word\" in \"$guesses\" guesses"
  189.  
  190.       echo " with $badguesses incorrect guesses"
  191.  
  192.       choice= replay
  193.  
  194.       done
  195.  
  196.       exit 0
  197.  
  198.  
Note my changes in lines 57, 70+72 and 192+194. The game is now surrounded by a big loop, which will be left if the player says not 'y'.

arne
May 21 '07 #6
Note my changes in lines 57, 70+72 and 192+194. The game is now surrounded by a big loop, which will be left if the player says not 'y'.

arne

wow.. you have tested it? beacuse it only loops around the choose number of players for me?

K
May 21 '07 #7
arne
315 Expert 100+
wow.. you have tested it? beacuse it only loops around the choose number of players for me?

K
Yes, I have. Works fine for me. You only have to refine your "random" word (it's always the same right now :) )
May 22 '07 #8
Yes, I have. Works fine for me. You only have to refine your "random" word (it's always the same right now :) )
code now is a bit tider i think, but i am having a sever trouble with the line:

Expand|Select|Wrap|Line Numbers
  1.  
  2. if [ $life -eq 0 ]; then
  3.          echo "THE WORD YOU WERE TRYING TO GUESS WAS \"$word\""
  4.         choice= replay
  5.         #startup
  6.         #replay
  7.        exit 0
  8. fi
  9.  
i have tried all the combination to get it to replay again, but i have no idea why it dosent.. when life become 0 it kicks me out of the game?

Any Idea?

K


Expand|Select|Wrap|Line Numbers
  1. #!/bin/bash
  2.  
  3. stored_word()
  4. {
  5.   case $(( $$ % 10 )) in
  6.     0 ) echo "energy"    ;;  1 ) echo "touch" ;;
  7.     2 ) echo "climbing" ;;   3 ) echo "declare" ;;
  8.     4 ) echo "marry"  ;;     5 ) echo "relax"   ;;
  9.     6 ) echo "bugs"     ;;   7 ) echo "inaccessible" ;;
  10.     8 ) echo "country" ;;    9 ) echo "folder"
  11.   esac
  12. }
  13.  
  14. function life() {
  15. life=1
  16. }
  17.  
  18.  
  19. function startup() {
  20.  
  21. echo "Choose number of Players:"
  22. read players
  23.  
  24. if [ $players -eq 1 ] ; then
  25.         echo " A Random word has been chosen... 
  26.  
  27. Enjoy the Game"
  28.         word=$(stored_word)
  29.         letters=$(echo $word | wc -c)
  30.         letters=$(( $letters - 1 ))
  31.         template="$(echo $word | tr '[a-z A-Z 0-9]' '.')"
  32.         remaining=$letters
  33.         guess=""
  34.         guessed=0
  35.         badguesses=0
  36.  
  37. elif [ $players -eq 2 ] ; then
  38.         echo "choose a word for player two to guess:"
  39.         read player2word
  40.        # clear
  41.         word=$player2word
  42.         letters=$(echo $word | wc -c)
  43.         letters=$(( $letters - 1 ))
  44.         template="$(echo $word | tr '[a-z A-Z 0-9]' '.')"
  45.         remaining=$letters
  46.         guess=""
  47.         guessed=0
  48.         badguesses=0
  49.  
  50. else
  51.         echo "incorrect option..."
  52.         choice= replay
  53. fi
  54. }
  55.  
  56. function replay() {
  57. echo " Do you wish to play again? TYPE \"y\" to play 
  58.  
  59. again or \"n\" to quit"
  60. read choice
  61.  
  62. if [ $choice == y ] ; then
  63.         echo
  64. else
  65. echo "Hope you enjoyed the game"
  66. exit 0
  67. fi
  68. }
  69.  
  70. choice=y
  71.  
  72. while [ $choice == y ]; do
  73. startup
  74. life
  75.  
  76. echo "                     ************** The word you are 
  77.  
  78. trying to guess has \"$letters\" letters **************"
  79. echo""
  80. echo""
  81.  
  82. while [ $template != $word ] ; do
  83.         echo""
  84.         echo -n "Word is: $template Please choose a 
  85.  
  86. Letter: " ;
  87.         read guess
  88.          guesses=$(( $guesses + 1 ))
  89.          echo " you have chosen $guess"
  90.      if echo $guessed | grep -i $guess > .temp1 ; then
  91.          echo "You've already guessed that letter. Try 
  92.  
  93. again!"
  94.  guessed="$guessed$guess"
  95.         echo $letter
  96.      elif ! echo $word | grep -i $guess > .temp1 ; then
  97.         echo "Sorry, the letter \"$guess\" is not in the 
  98.  
  99. word."
  100.         guessed="$guessed$guess"
  101.         badguesses=$(( $badguesses + 1))
  102.          echo "$guessed"
  103.          life=$(( $life -1 ))
  104.          echo " you have $life life left"
  105.      else
  106.           echo "Good going! The letter $guess is in the 
  107.  
  108. word!"
  109.           guessed="$guessed$guess"
  110.           echo $letter
  111.      fi
  112.  
  113. if [ $guess == $word ]; then
  114.         echo "you have guessed the word $word"
  115.         choice= replay
  116.         exit 0
  117. fi
  118.  
  119. if [ $life -eq 0 ]; then
  120.          echo "THE WORD YOU WERE TRYING TO 
  121.  
  122. GUESS WAS \"$word\""
  123.         #choice= replay
  124.         #startup
  125.         #replay
  126.        exit 0
  127. fi
  128.  
  129.       lettercount=0
  130.       template2=""
  131.       while [ $lettercount != $(( $letters )) ] ; do
  132.         val1=${word:lettercount:1}
  133.         val2=${template:lettercount:1}
  134.           if [ "$val1" == "$guess" ] ; then
  135.           template2="$template2$guess"
  136.           elif [ "$val2" != '.' ] ; then
  137.           template2="$template2$val2"
  138.           else
  139.           template2="$template2."
  140.           fi
  141.           lettercount=$(( $lettercount + 1 ))
  142.  done
  143.       template=$template2
  144. done
  145.  
  146. echo -n "Congratulations! You guessed \"$word\" in 
  147.  
  148. \"$guesses\" guesses"
  149. echo " with $badguesses incorrect guesses"
  150. echo ""
  151. echo ""
  152. guesses=0
  153. guess=""
  154. badguesses=
  155. choice= replay
  156. done
  157. exit 0
  158.  
  159.  
May 22 '07 #9
arne
315 Expert 100+
code now is a bit tider i think, but i am having a sever trouble with the line:

Expand|Select|Wrap|Line Numbers
  1.  
  2. if [ $life -eq 0 ]; then
  3.          echo "THE WORD YOU WERE TRYING TO GUESS WAS \"$word\""
  4.         choice= replay
  5.         #startup
  6.         #replay
  7.        exit 0
  8. fi
  9.  
I'm not sure I understand: if you call "exit 0;" somehwere in the program it will exit immediately. Instead of calling exit, you should jump back to the beginning of the loop if choce is 'y'. Use the "continue" command, for instance.

HTH,
arne
May 22 '07 #10
I'm not sure I understand: if you call "exit 0;" somehwere in the program it will exit immediately. Instead of calling exit, you should jump back to the beginning of the loop if choce is 'y'. Use the "continue" command, for instance.

HTH,
arne
I used continue, what it will do is contiune the script even when life is = 0

I am not even sure what i need to do next, as i have tried everything i know now.

K
May 22 '07 #11
arne
315 Expert 100+
I used continue, what it will do is contiune the script even when life is = 0

I am not even sure what i need to do next, as i have tried everything i know now.

K
Expand|Select|Wrap|Line Numbers
  1. if [ $life -eq 0 ]; then     
  2.   echo "THE WORD YOU WERE TRYING TO GUESS WAS \"$word\""     
  3.   replay
  4.   continue
  5. fi
  6.  
will continue the loop. Make sure to reset 'life' to 10, to clear the template and to choose another word.

HTH,
arne
May 23 '07 #12
Expand|Select|Wrap|Line Numbers
  1. if [ $life -eq 0 ]; then     
  2.   echo "THE WORD YOU WERE TRYING TO GUESS WAS \"$word\""     
  3.   replay
  4.   continue
  5. fi
  6.  
will continue the loop. Make sure to reset 'life' to 10, to clear the template and to choose another word.

HTH,
arne
I have managed to set the life counter to 10, by creating a function and calling it when i need to. The only problem now is that not sure why it keeps on calling the same word over and over again when 1 player option is chosen. is there a way to clear the template?

K
May 23 '07 #13
arne
315 Expert 100+
I have managed to set the life counter to 10, by creating a function and calling it when i need to. The only problem now is that not sure why it keeps on calling the same word over and over again when 1 player option is chosen. is there a way to clear the template?

K
What about defining a function that will select a new word randomly and set the template accordingly?

arne
May 23 '07 #14
What about defining a function that will select a new word randomly and set the template accordingly?

arne
Expand|Select|Wrap|Line Numbers
  1. stored_word()
  2. {
  3.   case $(( $$ % 10 )) in
  4.     0 ) echo "energy"    ;;  1 ) echo "touch" ;;
  5.     2 ) echo "climbing" ;;   3 ) echo "declare" ;;
  6.     4 ) echo "marry"  ;;     5 ) echo "relax"   ;;
  7.     6 ) echo "bugs"     ;;   7 ) echo "inaccessible" ;;
  8.     8 ) echo "country" ;;    9 ) echo "folder"
  9.   esac
  10. }
  11.  
  12.  
thats what the first funtion dose. I think the main problem is that once the $word is set, it remains the same through out the cycle of the program and only once you exit the game it resets to zero.

have i misunderstood you?

K
May 23 '07 #15
arne
315 Expert 100+
Expand|Select|Wrap|Line Numbers
  1. stored_word()
  2. {
  3.   case $(( $$ % 10 )) in
  4.     0 ) echo "energy"    ;;  1 ) echo "touch" ;;
  5.     2 ) echo "climbing" ;;   3 ) echo "declare" ;;
  6.     4 ) echo "marry"  ;;     5 ) echo "relax"   ;;
  7.     6 ) echo "bugs"     ;;   7 ) echo "inaccessible" ;;
  8.     8 ) echo "country" ;;    9 ) echo "folder"
  9.   esac
  10. }
  11.  
  12.  
thats what the first funtion dose. I think the main problem is that once the $word is set, it remains the same through out the cycle of the program and only once you exit the game it resets to zero.

have i misunderstood you?

K

Yes, but this function (or another one) may also set the template, since if you run out of lifes and you want to play again, your program will reuse the template with the already guessed letters in it ...

arne
May 23 '07 #16
Yes, but this function (or another one) may also set the template, since if you run out of lifes and you want to play again, your program will reuse the template with the already guessed letters in it ...

arne
Ok i am officially raising my hand and putting a sign up saying i am too stupid and thick.. sorry :( i dont understand

K
May 23 '07 #17
arne
315 Expert 100+
Ok i am officially raising my hand and putting a sign up saying i am too stupid and thick.. sorry :( i dont understand

K
Ok, the problem is that the continue jumps to the beginning of the inner loop. What we want is to jump to the beginning of the outer loop. So, try

Expand|Select|Wrap|Line Numbers
  1.      flag=0
  2.      if [ $life -eq 0 ]; then
  3.  
  4.      echo "THE WORD YOU WERE TRYING TO GUESS WAS \"$word\""
  5.  
  6.               replay
  7.           flag=1
  8.           break
  9.      fi
  10.  
and

Expand|Select|Wrap|Line Numbers
  1.      if [ $flag -eq 1 ]; then
  2.        continue;
  3.      fi
  4.  
  5.      echo -n "Congratulations! You guessed \"$word\" in \"$guesses\" guesses"
  6.  
I added some context so that you can see where to insert the changes.

BTW, try this stored_word function. If you use $$, i.e. the process PID, you will always choose the ssame word for a second game

Expand|Select|Wrap|Line Numbers
  1. stored_word()
  2.  {
  3.      number=$RANDOM
  4.      let "number %= 10"
  5.      case $number in     
  6.      0 ) echo "energy"    ;;  1 ) echo "touch" ;;     
  7.      2 ) echo "climbing" ;;   3 ) echo "declare" ;;     
  8.      4 ) echo "marry"  ;;     5 ) echo "relax"   ;;     
  9.      6 ) echo "bugs"     ;;   7 ) echo "inaccessible" ;;     
  10.      8 ) echo "country" ;;    9 ) echo "folder"         
  11.      esac     
  12.  }
  13.  
HTH,
arne
May 23 '07 #18

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Jeff Kish | last post by:
Greetings. I can't invest a large amount of time into this, but it would be very helpful if I could do this. I have a directory full of xml files I'd like to be able to query to find out...
11
by: Magnus Jonneryd | last post by:
Hi, I'm planning on writing a program that interactively is fed input via a shell (bash). I also want to be able to write a shell script that executes various commands related to my program. In...
4
by: 4zumanga | last post by:
I have a bunch of really horrible hacked-up bash scripts which I would really like to convert to python, so I can extend and neaten them. However, I'm having some trouble mapping some constructs...
16
by: John Salerno | last post by:
Hi all. I just installed Ubuntu and I'm learning how to use the bash shell. Aside from the normal commands you can use, I was wondering if it's possible to use Python from the terminal instead of...
22
by: sri | last post by:
Hi I am new to C language. Still I am using Turbo C++ 3 Compiler. Any New version is available for Windows XP platforms. Borland releases C++ 5.5 Command line tools. Is There any New C Compiler...
3
by: gham | last post by:
I am a complete noob to linux and shell scripting please help this is what I am trying to do 1. Create a script that takes 1 argument being a file, read the inputted file, and look for...
4
by: melmack3 | last post by:
Hello My PHP script executes many bash/cmd commands. Functions like "exec()" or "system()" cause that new bash/cmd session is started, the command is executed and the session is closed....
4
by: hgdien | last post by:
I am a complete newbie at Perl. I have just started getting from bash to Perl language. I am trying to do a simple perl scripting that takes three arguments: two integers and an operation (+, -, * or...
6
by: Frantisek Malina | last post by:
What is the best way to do the regular bash commands in native python? - create directory - create file - make a symlink - copy a file to another directory - move a file - set permissions ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.