[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: multi-line alias executed out of order
From: |
Chet Ramey |
Subject: |
Re: multi-line alias executed out of order |
Date: |
Tue, 17 Dec 2013 10:14:23 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 |
> Description:In a multi-line alias, where entries are separated by semi-colon,
> "source" commands are not executed in-step with all the other commands.
> After all the non "source" commands are executed, the "source" commands are
> executed in reverse order. See below for an example.
> Repeat-By:
> ubuntu@ubuntu:~$ cat script.sh#!/bin/bash(echo -n "$1 "; date
> +%S.%N)ubuntu@ubuntu:~$ alias foo1alias foo1='~/script.sh one; source
> ~/script.sh two; source ~/script.sh three; ~/script.sh four'ubuntu@ubuntu:~$
> alias foo2alias foo2='~/script.sh one;source ~/script.sh two;source
> ~/script.sh three;~/script.sh four;'ubuntu@ubuntu:~$ foo1one 09.742581873two
> 09.745315889three 09.749212492four 09.761410711ubuntu@ubuntu:~$ foo2one
> 11.805819275four 11.819741270three 11.828260887two 11.829470548
> Fix:
> Use a single-line alias. Or use the "&&" operator to chain commands (which
> changes the functionality to be short-circuit evaluations).
I can't reproduce this on Mac OS X or RHEL 5. You might also consider
adding a few newlines into your report for readability.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/