Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Justifying text output
- X-seq: zsh-users 7155
- From: Thorsten Kampe <thorsten@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Justifying text output
- Date: Fri, 12 Mar 2004 03:01:10 +0100
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Sender: news <news@xxxxxxxxxxxxx>
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
`---
Messages sorted by:
Reverse Date,
Date,
Thread,
Author