From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 581 invoked from network); 12 Mar 2004 02:02:20 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 12 Mar 2004 02:02:20 -0000 Received: (qmail 7707 invoked by alias); 12 Mar 2004 02:01:19 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7155 Received: (qmail 7686 invoked from network); 12 Mar 2004 02:01:16 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 12 Mar 2004 02:01:16 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [80.91.224.249] by sunsite.dk (MessageWall 1.0.8) with SMTP; 12 Mar 2004 2:1:14 -0000 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1B1bz8-0004IO-00 for ; Fri, 12 Mar 2004 03:01:14 +0100 Received: from isi-dialin-129-155.isionline-dialin.de ([195.158.129.155]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 12 Mar 2004 03:01:14 +0100 Received: from thorsten by isi-dialin-129-155.isionline-dialin.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 12 Mar 2004 03:01:14 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@sunsite.dk From: Thorsten Kampe Subject: Justifying text output Date: Fri, 12 Mar 2004 03:01:10 +0100 Message-ID: <1mm7og67rpkdy.dlg@thorstenkampe.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: isi-dialin-129-155.isionline-dialin.de User-Agent: 40tude_Dialog/2.0.10.1de Sender: news 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 `---