zsh-users
 help / color / mirror / code / Atom feed
* Justifying text output
@ 2004-03-12  2:01 Thorsten Kampe
  2004-03-12 10:55 ` Bart Schaefer
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Thorsten Kampe @ 2004-03-12  2:01 UTC (permalink / raw)
  To: zsh-users

I wrote a little script[1] that compiles the main zsh config files. Is
there any way to make the "[ ok ]"/"[ failed ]" messages on the right
justified?

Now:
! ERROR:    /etc/zsh/zprofile - directory not writable  [ failed ]
* compiling /home/thorsten/.zsh/.zlogin  [ ok ]
* compiling /home/thorsten/.zsh/.zshrc  [ ok ]
* compiling /home/thorsten/.zshenv  [ ok ]

Should be like that
! ERROR:    /etc/zsh/zprofile - directory not writable  [ failed ]
* compiling /home/thorsten/.zsh/.zlogin                 [ ok ]
* compiling /home/thorsten/.zsh/.zshrc                  [ ok ]
* compiling /home/thorsten/.zshenv                      [ ok ]

The problem is that there may be an error or no error whether I
execute this script as root or as a normal user. And some files don't
exist (/etc/zprofile and /etc/profile.d/zshell.zsh on Gentoo and
/etc/zsh/zprofile in Cygwin). So the output differs from case to case.

Thorsten

[1]
,---
| #! /bin/zsh -f
| emulate -LR zsh
| 
| autoload -U colors
| colors  # zshcontrib(1)
| 
| ltgreen=$fg_bold[green]
| ltred=$fg_bold[red]
| white=$fg_no_bold[white]
| 
| for file in /etc/profile.d/zshell.zsh \
|             /etc/zsh/zprofile         \
|             /etc/zprofile             \
|             ~/.zsh/.zlogin            \
|             ~/.zsh/.zshrc             \
|             ~/.zshenv
| do if   [[ -e $file && ! -r $file ]]
|    then echo "${ltred}* ${white}ERROR:    $file - file not readable  [ ${ltred}failed ${white}]"
|    elif [[ -e $file && ! -w $(dirname $file) ]]
|    then echo "${ltred}! ${white}ERROR:    $file - directory not writable  [ ${ltred}failed ${white}]"
|    elif [[ -r $file && -w $(dirname $file) ]]
|    then echo "${ltgreen}* ${white}compiling $file  [ ${ltgreen}ok ${white}]"
|         zcompile -R $file
|    fi
| done
`---


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-03-13 19:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-12  2:01 Justifying text output Thorsten Kampe
2004-03-12 10:55 ` Bart Schaefer
2004-03-12 23:24   ` Thorsten Kampe
2004-03-13  6:24     ` Bart Schaefer
2004-03-13 17:48       ` Thorsten Kampe
2004-03-13 18:58         ` Oliver Kiddle
2004-03-12 10:59 ` Peter Stephenson
2004-03-12 22:33   ` Thorsten Kampe
2004-03-13  3:29   ` Thorsten Kampe
2004-03-12 11:28 ` Oliver Kiddle
2004-03-12 22:33   ` Thorsten Kampe
2004-03-12 23:03     ` Pavol Juhas

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).