* Output not being echo'd in shell scripts.
@ 2006-07-17 4:52 Sean
2006-07-23 10:38 ` zzapper
0 siblings, 1 reply; 3+ messages in thread
From: Sean @ 2006-07-17 4:52 UTC (permalink / raw)
To: zsh-users
I am having problems running a simple shell script: todo.sh [todotxt.com]
I am running the windows port of zsh (ver 3.0.5) supplied with unixkit-tiny.
The problem is simply that commands that work when entered directly at
the prompt do not seem to work when run in a shell script.
I have tested the script by running each line in the shell and I
believe the problem is related to the echo command.
For instance, the command:
"todo.sh list" should list all items in the todo.txt file but instead
returns this:
--
TODO: tasks in /unixkit/todo/todo.txt.
If I execute the appropriate commands directly in the shell like this:
echo -e "`sed = "/unixkit/todo/todo.txt" | sed 'N; s/^/ /; s/
*\(.\{2,\}\)\n/\1 /' | sed 's/^ /0/' | sort -k2 | sed
's/\(.*(A).*\)/'$PRI_A'\1'$DEFAULT'/g' | sed
's/\(.*(B).*\)/'$PRI_B'\1'$'/g' | sed 's/\(.*(C).* \)/'$PRI_C'\1'$'/g'
| sed 's/\(.*([A-Z]).*\)/'$PRI_X'\1'$DEFAULT'/g'`"
I get the appropriate result:
01 Compile list of items to sell p:garage_cleanup @home
If I add -x to the shebang, I get the following:
____
+ action=list
+ item=
+ '[' -z '' ']'
++ sed = /unixkit/todo/todo.txt
++ sed 'N; s/^/ /; s/ *\(.\{2,\}\)\n/\1 /'
++ sed 's/^ /0/'
++ sort -k2
++ sed 's/\(.*(A).*\)/\\033[1;33m\1\\033[0m/g'
++ sed 's/\(.*(B).*\)/\\033[0;32m\1/g'
++ sed 's/\(.*(C).* \)/\\033[1;34m\1/g'
++ sed 's/\(.*([A-Z]).*\)/\\033[1;37m\1\\033[0m/g'
+ echo -e ''
+ echo --
--
++ wc -l /unixkit/todo/todo.txt
++ sed 's/^[[:space:]]*\([0-9]*\).*/\1/'
+ NUMTASKS=
+ echo 'TODO: tasks in /unixkit/todo/todo.txt.'
TODO: tasks in /unixkit/todo/todo.txt.
+ cleanup
+ '[' -f /unixkit/todo/todo.tmp ']'
+ rm /unixkit/todo/todo.tmp
+ exit 0
____
Anyway, I was hoping that it is somthing simple that I am doing wrong
/ need to configure in the zsh environment.
TIA
Sean
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Output not being echo'd in shell scripts.
2006-07-17 4:52 Output not being echo'd in shell scripts Sean
@ 2006-07-23 10:38 ` zzapper
2006-07-23 22:06 ` Phil Pennock
0 siblings, 1 reply; 3+ messages in thread
From: zzapper @ 2006-07-23 10:38 UTC (permalink / raw)
To: zsh-users
Sean <schliden@gmail.com> wrote in
news:96c45c490607162152k4d7d81b8x5d143c7b5c51d585@mail.gmail.com:
> I am having problems running a simple shell script: todo.sh
> [todotxt.com]
>
> I am running the windows port of zsh (ver 3.0.5) supplied with
> unixkit-tiny.
>
> The problem is simply that commands that work when entered directly at
> the prompt do not seem to work when run in a shell script.
>
> I have tested the script by running each line in the shell and I
> believe the problem is related to the echo command.
>
> For instance, the command:
>
> "todo.sh list" should list all items in the todo.txt file but instead
> returns this:
>
> --
> TODO: tasks in /unixkit/todo/todo.txt.
>
>
> If I execute the appropriate commands directly in the shell like this:
>
> echo -e "`sed = "/unixkit/todo/todo.txt" | sed 'N; s/^/ /; s/
> *\(.\{2,\}\)\n/\1 /' | sed 's/^ /0/' | sort -k2 | sed
> 's/\(.*(A).*\)/'$PRI_A'\1'$DEFAULT'/g' | sed
> 's/\(.*(B).*\)/'$PRI_B'\1'$'/g' | sed 's/\(.*(C).* \)/'$PRI_C'\1'$'/g'
>| sed 's/\(.*([A-Z]).*\)/'$PRI_X'\1'$DEFAULT'/g'`"
>
> I get the appropriate result:
>
> 01 Compile list of items to sell p:garage_cleanup @home
>
> If I add -x to the shebang, I get the following:
> ____
>
> + action=list
> + item=
> + '[' -z '' ']'
> ++ sed = /unixkit/todo/todo.txt
> ++ sed 'N; s/^/ /; s/ *\(.\{2,\}\)\n/\1 /'
> ++ sed 's/^ /0/'
> ++ sort -k2
> ++ sed 's/\(.*(A).*\)/\\033[1;33m\1\\033[0m/g'
> ++ sed 's/\(.*(B).*\)/\\033[0;32m\1/g'
> ++ sed 's/\(.*(C).* \)/\\033[1;34m\1/g'
> ++ sed 's/\(.*([A-Z]).*\)/\\033[1;37m\1\\033[0m/g'
> + echo -e ''
>
> + echo --
> --
> ++ wc -l /unixkit/todo/todo.txt
> ++ sed 's/^[[:space:]]*\([0-9]*\).*/\1/'
> + NUMTASKS=
> + echo 'TODO: tasks in /unixkit/todo/todo.txt.'
> TODO: tasks in /unixkit/todo/todo.txt.
> + cleanup
> + '[' -f /unixkit/todo/todo.tmp ']'
> + rm /unixkit/todo/todo.tmp
> + exit 0
> ____
>
> Anyway, I was hoping that it is somthing simple that I am doing wrong
> / need to configure in the zsh environment.
>
> TIA
>
> Sean
>
>
Hi Sean
I don't know if the following is relevant to your problem:-
Do you have the following option set?
setopt no_prompt_cr #needed for perl scripts
This is an old zsh chestnut where zsh does not output if there is no
trailing CRHTH
--
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Output not being echo'd in shell scripts.
2006-07-23 10:38 ` zzapper
@ 2006-07-23 22:06 ` Phil Pennock
0 siblings, 0 replies; 3+ messages in thread
From: Phil Pennock @ 2006-07-23 22:06 UTC (permalink / raw)
To: zsh-users
On 2006-07-23 at 10:38 +0000, zzapper wrote:
> setopt no_prompt_cr #needed for perl scripts
>
> This is an old zsh chestnut where zsh does not output if there is no
> trailing CRHTH
zsh doesn't really control whether or not other commands produce output.
By default, without setting that option, zsh outputs a Carriage Return
at the start of a prompt; that's the CR of CRLF fame, which sends the
cursor position back to the start of the line. End result is that
output gets overwritten so that you don't see it.
--
VISTA: Viruses, Infections, Spyware, Trojans & Adware
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-07-23 22:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-17 4:52 Output not being echo'd in shell scripts Sean
2006-07-23 10:38 ` zzapper
2006-07-23 22:06 ` Phil Pennock
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).