* Bash Problem
@ Janina Sajka
` David Bruzos
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Janina Sajka @ UTC (permalink / raw)
To: ma-linux, speakup, blinux-list-bounces
I'm confused over some simple bash syntax. If I write the following at
the bash (ver 3.0) prompt, all works as expected--no errors.
But, if I execute from a script file (which begins with a #!/bin/bash of
course), I get:
line 4: syntax error near unexpected token `then'
What am I missing? All help much appreciated.
for in $( ls); do
if [ "$i" != "incoming/" ]; then
echo $i
fi
done
--
Janina Sajka Phone: +1.202.494.7040
Partner, Capital Accessibility LLC http://www.CapitalAccessibility.Com
Chair, Accessibility Workgroup Free Standards Group (FSG)
janina@freestandards.org http://a11y.org
If Linux can't solve your computing problem, you need a different problem.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: Bash Problem
Bash Problem Janina Sajka
@ ` David Bruzos
` Janina Sajka
` Sean McMahon
` Kirk Reiser
` (2 subsequent siblings)
3 siblings, 2 replies; 10+ messages in thread
From: David Bruzos @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
Hi Janina:
Could it be that you are missing the declaration of the "$i" variable. I added it and it worked for me. This is what I
got:
#!/bin/bash
for i in $(ls); do
if [ "$i" != "incoming/" ]; then
echo "$i"
fi
done
It seems as if you are missing the "i" after the "for".
HTH
David B.
On Thu, Apr 28, 2005 at 10:03:25AM -0400, Janina Sajka wrote:
> I'm confused over some simple bash syntax. If I write the following at
> the bash (ver 3.0) prompt, all works as expected--no errors.
>
> But, if I execute from a script file (which begins with a #!/bin/bash of
> course), I get:
>
> line 4: syntax error near unexpected token `then'
>
> What am I missing? All help much appreciated.
>
>
> for in $( ls); do
> if [ "$i" != "incoming/" ]; then
> echo $i
> fi
> done
>
>
> --
>
> Janina Sajka Phone: +1.202.494.7040
> Partner, Capital Accessibility LLC http://www.CapitalAccessibility.Com
>
> Chair, Accessibility Workgroup Free Standards Group (FSG)
> janina@freestandards.org http://a11y.org
>
> If Linux can't solve your computing problem, you need a different problem.
>
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: Bash Problem
` David Bruzos
@ ` Janina Sajka
` Sean McMahon
1 sibling, 0 replies; 10+ messages in thread
From: Janina Sajka @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
Yeah, David. I typed into the email by hand and did indeed forget the
declaration. But, it was in the actually test.sh file I wrote.
David Bruzos writes:
> Hi Janina:
> Could it be that you are missing the declaration of the "$i" variable. I added it and it worked for me. This is what I
> got:
>
> #!/bin/bash
>
> for i in $(ls); do
> if [ "$i" != "incoming/" ]; then
> echo "$i"
> fi
> done
>
> It seems as if you are missing the "i" after the "for".
>
> HTH
>
> David B.
>
> On Thu, Apr 28, 2005 at 10:03:25AM -0400, Janina Sajka wrote:
> > I'm confused over some simple bash syntax. If I write the following at
> > the bash (ver 3.0) prompt, all works as expected--no errors.
> >
> > But, if I execute from a script file (which begins with a #!/bin/bash of
> > course), I get:
> >
> > line 4: syntax error near unexpected token `then'
> >
> > What am I missing? All help much appreciated.
> >
> >
> > for in $( ls); do
> > if [ "$i" != "incoming/" ]; then
> > echo $i
> > fi
> > done
> >
> >
> > --
> >
> > Janina Sajka Phone: +1.202.494.7040
> > Partner, Capital Accessibility LLC http://www.CapitalAccessibility.Com
> >
> > Chair, Accessibility Workgroup Free Standards Group (FSG)
> > janina@freestandards.org http://a11y.org
> >
> > If Linux can't solve your computing problem, you need a different problem.
> >
> >
> > _______________________________________________
> > Speakup mailing list
> > Speakup@braille.uwo.ca
> > http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
--
Janina Sajka Phone: +1.202.494.7040
Partner, Capital Accessibility LLC http://www.CapitalAccessibility.Com
Chair, Accessibility Workgroup Free Standards Group (FSG)
janina@freestandards.org http://a11y.org
If Linux can't solve your computing problem, you need a different problem.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: Bash Problem
` David Bruzos
` Janina Sajka
@ ` Sean McMahon
1 sibling, 0 replies; 10+ messages in thread
From: Sean McMahon @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
So bash does work the same way as sh does, in that she is also missing the
double quote around the echo statement. single quotes for echo statements
without variables, double quotes for echo statements with variables. I'd like
to point out for portability, I always use sh instead of bash. You can probably
give the script the -x argument to debug it.
----- Original Message -----
From: "David Bruzos" <david@bruzos.org>
To: "Speakup is a screen review system for Linux." <speakup@braille.uwo.ca>
Sent: Thursday, April 28, 2005 7:49 AM
Subject: Re: Bash Problem
> Hi Janina:
> Could it be that you are missing the declaration of the "$i" variable. I
added it and it worked for me. This is what I
> got:
>
> #!/bin/bash
>
> for i in $(ls); do
> if [ "$i" != "incoming/" ]; then
> echo "$i"
> fi
> done
>
> It seems as if you are missing the "i" after the "for".
>
> HTH
>
> David B.
>
> On Thu, Apr 28, 2005 at 10:03:25AM -0400, Janina Sajka wrote:
> > I'm confused over some simple bash syntax. If I write the following at
> > the bash (ver 3.0) prompt, all works as expected--no errors.
> >
> > But, if I execute from a script file (which begins with a #!/bin/bash of
> > course), I get:
> >
> > line 4: syntax error near unexpected token `then'
> >
> > What am I missing? All help much appreciated.
> >
> >
> > for in $( ls); do
> > if [ "$i" != "incoming/" ]; then
> > echo $i
> > fi
> > done
> >
> >
> > --
> >
> > Janina Sajka Phone: +1.202.494.7040
> > Partner, Capital Accessibility LLC http://www.CapitalAccessibility.Com
> >
> > Chair, Accessibility Workgroup Free Standards Group (FSG)
> > janina@freestandards.org http://a11y.org
> >
> > If Linux can't solve your computing problem, you need a different problem.
> >
> >
> > _______________________________________________
> > Speakup mailing list
> > Speakup@braille.uwo.ca
> > http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Bash Problem
Bash Problem Janina Sajka
` David Bruzos
@ ` Kirk Reiser
` Lorenzo Taylor
` Laura Eaves
3 siblings, 0 replies; 10+ messages in thread
From: Kirk Reiser @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
Cc: blinux-list-bounces, ma-linux
Looks to me as though you left the 'i' variable out of your for
statement.
Kirk
--
Kirk Reiser The Computer Braille Facility
e-mail: kirk@braille.uwo.ca University of Western Ontario
phone: (519) 661-3061
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Bash Problem
Bash Problem Janina Sajka
` David Bruzos
` Kirk Reiser
@ ` Lorenzo Taylor
` Laura Eaves
3 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Taylor @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Janina Sajka's comments on Bash Problem were as follows:
# for in $( ls); do
# if [ "$i" != "incoming/" ]; then
# echo $i
# fi
# done
If I paste the above lines into a file exactly as written, I get syntax errors
on line 1. If I change
for in $( ls); do
to
for i in $( ls); do
it works fine in my bash 3.0 both at the prompt and as a script.
Lorenzo
- --
"We decided that we should evaluate the Microsoft offerings first. Once we
realised what a powerful set of tools they were, it became self-evident this was
the right way to go down."
Microsoft: the right way to go down
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCcUrzG9IpekrhBfIRAs1eAJoCUFq1PQM8PzX/IKqKE+dH8U3RnACdFp23
6SO2hiToiCRubqRztgWo/Zk=
=QqY/
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Bash Problem
Bash Problem Janina Sajka
` (2 preceding siblings ...)
` Lorenzo Taylor
@ ` Laura Eaves
3 siblings, 0 replies; 10+ messages in thread
From: Laura Eaves @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
Did you mean "for i in..." rather than "for in..."?
don't know why that would cause that particular error, but it looks wrong to
leave out the i.
--le
----- Original Message -----
From: "Janina Sajka" <janina@rednote.net>
To: <ma-linux@tux.org>; <speakup@braille.uwo.ca>;
<blinux-list-bounces@redhat.com>
Sent: Thursday, April 28, 2005 10:03 AM
Subject: Bash Problem
I'm confused over some simple bash syntax. If I write the following at
the bash (ver 3.0) prompt, all works as expected--no errors.
But, if I execute from a script file (which begins with a #!/bin/bash of
course), I get:
line 4: syntax error near unexpected token `then'
What am I missing? All help much appreciated.
for in $( ls); do
if [ "$i" != "incoming/" ]; then
echo $i
fi
done
--
Janina Sajka Phone: +1.202.494.7040
Partner, Capital Accessibility LLC http://www.CapitalAccessibility.Com
Chair, Accessibility Workgroup Free Standards Group (FSG)
janina@freestandards.org http://a11y.org
If Linux can't solve your computing problem, you need a different problem.
_______________________________________________
Speakup mailing list
Speakup@braille.uwo.ca
http://speech.braille.uwo.ca/mailman/listinfo/speakup
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: Bash Problem
@ Dawes, Stephen
` Janina Sajka
0 siblings, 1 reply; 10+ messages in thread
From: Dawes, Stephen @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
Janina,
I ran into something like this awhile back.
I did some research into my problem, and all I could attribute it to is
selinux.
Everything that I read as a result of a google search on my error
pointed to selinux.
As soon as I turned selinux off all start working again.
I discovered that my problem was not just only in a script that I was
writing at the time, but that it was also causing problems in scripts
that were working all along.
They all started working as they should as soon as I disabled selinux.
Now, to the how do you disable selinux.
There is a selinux config file in /etc/selinux.
Edit /etc/selinux/config and change the appropriate settings.
To help, here is what my /etc/selinux/config file looks like:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
# SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
Hope this solves your problem.
Steve Dawes
Phone: (403) 268-5527
Email: SDawes@calgary.ca
NOTICE -
This communication is intended ONLY for the use of the person or entity named above and may contain information that is confidential or legally privileged. If you are not the intended recipient named above or a person responsible for delivering messages or communications to the intended recipient, YOU ARE HEREBY NOTIFIED that any use, distribution, or copying of this communication or any of the information contained in it is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone and then destroy or delete this communication, or return it to us by mail if requested by us. The City of Calgary thanks you for your attention and cooperation.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Bash Problem
Dawes, Stephen
@ ` Janina Sajka
0 siblings, 0 replies; 10+ messages in thread
From: Janina Sajka @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
Fascinating, Steve. I've meant to have iptables off, but they weren't.
That should not make a difference, but it does seem to. In any case, all
is well know, and the syntax is sitting in a cron.hourly job with its
real task in place.
Dawes, Stephen writes:
> Janina,
>
> I ran into something like this awhile back.
> I did some research into my problem, and all I could attribute it to is
> selinux.
> Everything that I read as a result of a google search on my error
> pointed to selinux.
> As soon as I turned selinux off all start working again.
> I discovered that my problem was not just only in a script that I was
> writing at the time, but that it was also causing problems in scripts
> that were working all along.
> They all started working as they should as soon as I disabled selinux.
>
> Now, to the how do you disable selinux.
> There is a selinux config file in /etc/selinux.
> Edit /etc/selinux/config and change the appropriate settings.
>
> To help, here is what my /etc/selinux/config file looks like:
> # This file controls the state of SELinux on the system.
> # SELINUX= can take one of these three values:
> # enforcing - SELinux security policy is enforced.
> # permissive - SELinux prints warnings instead of enforcing.
> # disabled - No SELinux policy is loaded.
> # SELINUX=enforcing
> SELINUX=disabled
> # SELINUXTYPE= can take one of these two values:
> # targeted - Only targeted network daemons are protected.
> # strict - Full SELinux protection.
> SELINUXTYPE=targeted
>
> Hope this solves your problem.
>
>
> Steve Dawes
> Phone: (403) 268-5527
> Email: SDawes@calgary.ca
>
>
>
>
> NOTICE -
> This communication is intended ONLY for the use of the person or entity named above and may contain information that is confidential or legally privileged. If you are not the intended recipient named above or a person responsible for delivering messages or communications to the intended recipient, YOU ARE HEREBY NOTIFIED that any use, distribution, or copying of this communication or any of the information contained in it is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone and then destroy or delete this communication, or return it to us by mail if requested by us. The City of Calgary thanks you for your attention and cooperation.
>
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
--
Janina Sajka Phone: +1.202.494.7040
Partner, Capital Accessibility LLC http://www.CapitalAccessibility.Com
Chair, Accessibility Workgroup Free Standards Group (FSG)
janina@freestandards.org http://a11y.org
If Linux can't solve your computing problem, you need a different problem.
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: Bash Problem
@ Dawes, Stephen
0 siblings, 0 replies; 10+ messages in thread
From: Dawes, Stephen @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
The computer that I was having the problem on does not have iptables
running either. So, maybe part of the problem with selinux is that it
needs iptables running for it not to interfer with scripts and the like.
All I know is that when I disabled selinux, all started working again.
Steve Dawes
Phone: (403) 268-5527
Email: SDawes@calgary.ca
NOTICE -
This communication is intended ONLY for the use of the person or entity named above and may contain information that is confidential or legally privileged. If you are not the intended recipient named above or a person responsible for delivering messages or communications to the intended recipient, YOU ARE HEREBY NOTIFIED that any use, distribution, or copying of this communication or any of the information contained in it is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone and then destroy or delete this communication, or return it to us by mail if requested by us. The City of Calgary thanks you for your attention and cooperation.
> -----Original Message-----
> From: speakup-bounces@braille.uwo.ca
> [mailto:speakup-bounces@braille.uwo.ca] On Behalf Of Janina Sajka
> Sent: 2005 April 28 9:16 AM
> To: Speakup is a screen review system for Linux.
> Subject: Re: Bash Problem
>
> Fascinating, Steve. I've meant to have iptables off, but they weren't.
> That should not make a difference, but it does seem to. In
> any case, all is well know, and the syntax is sitting in a
> cron.hourly job with its real task in place.
>
> Dawes, Stephen writes:
> > Janina,
> >
> > I ran into something like this awhile back.
> > I did some research into my problem, and all I could
> attribute it to
> > is selinux.
> > Everything that I read as a result of a google search on my error
> > pointed to selinux.
> > As soon as I turned selinux off all start working again.
> > I discovered that my problem was not just only in a script
> that I was
> > writing at the time, but that it was also causing problems
> in scripts
> > that were working all along.
> > They all started working as they should as soon as I
> disabled selinux.
> >
> > Now, to the how do you disable selinux.
> > There is a selinux config file in /etc/selinux.
> > Edit /etc/selinux/config and change the appropriate settings.
> >
> > To help, here is what my /etc/selinux/config file looks like:
> > # This file controls the state of SELinux on the system.
> > # SELINUX= can take one of these three values:
> > # enforcing - SELinux security policy is enforced.
> > # permissive - SELinux prints warnings instead of enforcing.
> > # disabled - No SELinux policy is loaded.
> > # SELINUX=enforcing
> > SELINUX=disabled
> > # SELINUXTYPE= can take one of these two values:
> > # targeted - Only targeted network daemons are protected.
> > # strict - Full SELinux protection.
> > SELINUXTYPE=targeted
> >
> > Hope this solves your problem.
> >
> >
> > Steve Dawes
> > Phone: (403) 268-5527
> > Email: SDawes@calgary.ca
> >
> >
> >
> >
> > NOTICE -
> > This communication is intended ONLY for the use of the
> person or entity named above and may contain information that
> is confidential or legally privileged. If you are not the
> intended recipient named above or a person responsible for
> delivering messages or communications to the intended
> recipient, YOU ARE HEREBY NOTIFIED that any use,
> distribution, or copying of this communication or any of the
> information contained in it is strictly prohibited. If you
> have received this communication in error, please notify us
> immediately by telephone and then destroy or delete this
> communication, or return it to us by mail if requested by us.
> The City of Calgary thanks you for your attention and cooperation.
> >
> >
> > _______________________________________________
> > Speakup mailing list
> > Speakup@braille.uwo.ca
> > http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
> --
>
> Janina Sajka Phone: +1.202.494.7040
> Partner, Capital Accessibility LLC
> http://www.CapitalAccessibility.Com
>
> Chair, Accessibility Workgroup Free Standards
> Group (FSG)
> janina@freestandards.org http://a11y.org
>
> If Linux can't solve your computing problem, you need a
> different problem.
>
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~ UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
Bash Problem Janina Sajka
` David Bruzos
` Janina Sajka
` Sean McMahon
` Kirk Reiser
` Lorenzo Taylor
` Laura Eaves
Dawes, Stephen
` Janina Sajka
Dawes, Stephen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).