Shell script error
Hello, it's me again. This time I'm trying to do some shell scripting but I'm running into a problem with a randomization script that I found on the web. The script I'm trying to run can be found at: http://www.bsdbooks.net/shells/scripting/randomvar.html#PICKCARD. Everything runs fine on different Linux systems that I've used (Red Hat 9, Knoppix-STD, PHLAK) but when I run the script on FreeBSD or OpenBSD I get errors. I'm mainly running FreeBSD 5.3-BETA right now with /shells/bash2 installed so that's where I'd really like to get it running. I did change the first line to point to /usr/local/bin/bash but that didn't make any difference. If anyone knows why this won't run, or if anyone has another example of getting a random character (I'd eventually like to generate a random hexadecimal character) I'd love to hear from you. Thanks, Ben ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Shell script error
That script works fine for me on my box and I'm also running FreeBSD 5.3-BETA with bash2. What kind of error are you getting? What is the output of bash -x scriptname.sh (filling in the script name of course). --Andy On Oct 7, 2004, at 7:07 AM, Pratt, Benjamin E. wrote: Hello, it's me again. This time I'm trying to do some shell scripting but I'm running into a problem with a randomization script that I found on the web. The script I'm trying to run can be found at: http://www.bsdbooks.net/shells/scripting/randomvar.html#PICKCARD. Everything runs fine on different Linux systems that I've used (Red Hat 9, Knoppix-STD, PHLAK) but when I run the script on FreeBSD or OpenBSD I get errors. I'm mainly running FreeBSD 5.3-BETA right now with /shells/bash2 installed so that's where I'd really like to get it running. I did change the first line to point to /usr/local/bin/bash but that didn't make any difference. If anyone knows why this won't run, or if anyone has another example of getting a random character (I'd eventually like to generate a random hexadecimal character) I'd love to hear from you. Thanks, Ben ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
RE: Shell script error
Sorry, I was using sh test.sh to execute the script and getting the error: test.sh: 28: Syntax error: word unexpected (expecting )) When I use ./test.sh to run it things work fine. Sorry for the clutter. Ben -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Moran Sent: Thursday, October 07, 2004 11:02 AM To: Pratt, Benjamin E. Cc: [EMAIL PROTECTED] Subject: Re: Shell script error That script works fine for me on my box and I'm also running FreeBSD 5.3-BETA with bash2. What kind of error are you getting? What is the output of bash -x scriptname.sh (filling in the script name of course). --Andy On Oct 7, 2004, at 7:07 AM, Pratt, Benjamin E. wrote: Hello, it's me again. This time I'm trying to do some shell scripting but I'm running into a problem with a randomization script that I found on the web. The script I'm trying to run can be found at: http://www.bsdbooks.net/shells/scripting/randomvar.html#PICKCARD. Everything runs fine on different Linux systems that I've used (Red Hat 9, Knoppix-STD, PHLAK) but when I run the script on FreeBSD or OpenBSD I get errors. I'm mainly running FreeBSD 5.3-BETA right now with /shells/bash2 installed so that's where I'd really like to get it running. I did change the first line to point to /usr/local/bin/bash but that didn't make any difference. If anyone knows why this won't run, or if anyone has another example of getting a random character (I'd eventually like to generate a random hexadecimal character) I'd love to hear from you. Thanks, Ben ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Shell script error
On 2004-10-07 09:01, Andrew Moran [EMAIL PROTECTED] wrote: On Oct 7, 2004, at 7:07 AM, Pratt, Benjamin E. wrote: Hello, it's me again. This time I'm trying to do some shell scripting but I'm running into a problem with a randomization script that I found on the web. The script I'm trying to run can be found at: http://www.bsdbooks.net/shells/scripting/randomvar.html#PICKCARD. Everything runs fine on different Linux systems that I've used (Red Hat 9, Knoppix-STD, PHLAK) but when I run the script on FreeBSD or OpenBSD I get errors. I'm mainly running FreeBSD 5.3-BETA right now with /shells/bash2 installed so that's where I'd really like to get it running. I did change the first line to point to /usr/local/bin/bash but that didn't make any difference. If anyone knows why this won't run, or if anyone has another example of getting a random character (I'd eventually like to generate a random hexadecimal character) I'd love to hear from you. That script works fine for me on my box and I'm also running FreeBSD 5.3-BETA with bash2. What kind of error are you getting? What is the output of bash -x scriptname.sh (filling in the script name of course). I've run this successfully on FreeBSD 6.0-CURRENT too. Some of the test runs are shown below: $ bash card.sh 9 of Clubs $ bash card.bash 6 of Spades $ bash card.bash King of Spades - Giorgos ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
RE: Shell script error
The reason that works on Linux and not on FreeBSD is that on Linux sh is really bash. On FreeBSD, sh is the bourne shell and bash is bash. Bash will run all sh scripts, but sh will not run all bash scripts. Bash extends the sh language. That script is a bash script, not a sh script. --Andy Friends may come and go but enemies accumulate. On Thu, 7 Oct 2004, Pratt, Benjamin E. wrote: Sorry, I was using sh test.sh to execute the script and getting the error: test.sh: 28: Syntax error: word unexpected (expecting )) When I use ./test.sh to run it things work fine. Sorry for the clutter. Ben -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Moran Sent: Thursday, October 07, 2004 11:02 AM To: Pratt, Benjamin E. Cc: [EMAIL PROTECTED] Subject: Re: Shell script error That script works fine for me on my box and I'm also running FreeBSD 5.3-BETA with bash2. What kind of error are you getting? What is the output of bash -x scriptname.sh (filling in the script name of course). --Andy On Oct 7, 2004, at 7:07 AM, Pratt, Benjamin E. wrote: Hello, it's me again. This time I'm trying to do some shell scripting but I'm running into a problem with a randomization script that I found on the web. The script I'm trying to run can be found at: http://www.bsdbooks.net/shells/scripting/randomvar.html#PICKCARD. Everything runs fine on different Linux systems that I've used (Red Hat 9, Knoppix-STD, PHLAK) but when I run the script on FreeBSD or OpenBSD I get errors. I'm mainly running FreeBSD 5.3-BETA right now with /shells/bash2 installed so that's where I'd really like to get it running. I did change the first line to point to /usr/local/bin/bash but that didn't make any difference. If anyone knows why this won't run, or if anyone has another example of getting a random character (I'd eventually like to generate a random hexadecimal character) I'd love to hear from you. Thanks, Ben ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]