ALT Linux Team development discussions
 help / color / mirror / Atom feed
  • * [devel] Re: как правильно выполнить команду?
        @ 2003-06-19 20:44       ` Mikhail Zabaluev
      1 sibling, 0 replies; 2+ messages in thread
    From: Mikhail Zabaluev @ 2003-06-19 20:44 UTC (permalink / raw)
      To: ALT Devel discussion list
    
    [-- Attachment #1: Type: text/plain, Size: 632 bytes --]
    
    Hello Grigory,
    
    On Thu, Jun 19, 2003 at 02:36:30PM +0300, Grigory Milev wrote:
    >
    >     >> CMD=/bin/date
    >     >> [ -x "$CMD" ] && "$CMD"
    > 
    >     > CMD=/bin/date
    >     > [ ! -x "$CMD" ] || "$CMD"
    > А в чем половая разница в этих двух вариантах?
    
    Первый в случае отсутствия /bin/date выдаёт ненулевой статус
    и вызывает аварийное завершение скрипта при некоторых опциях
    bash.
    
    Совсем безопасно и понятно можно написать так:
    
    CMD=/bin/date
    if test -x "$CMD"; then
        "$CMD"
    fi
    
    -- 
    Stay tuned,
      MhZ                                     JID: mhz@altlinux.org
    ___________
    To do two things at once is to do neither.
    		-- Publilius Syrus
    
    [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
    
    ^ permalink raw reply	[flat|nested] 2+ messages in thread

  • end of thread, other threads:[~2003-06-19 20:44 UTC | newest]
    
    Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
    -- links below jump to the message on this page --
    2003-06-19 14:58         ` [devel] Re: как правильно выполнить команду? Alexander Bokovoy
    2003-06-19 20:44       ` Mikhail Zabaluev
    

    ALT Linux Team development discussions
    
    This inbox may be cloned and mirrored by anyone:
    
    	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
    
    	# If you have public-inbox 1.1+ installed, you may
    	# initialize and index your mirror using the following commands:
    	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
    		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
    	public-inbox-index devel
    
    Example config snippet for mirrors.
    Newsgroup available over NNTP:
    	nntp://lore.altlinux.org/org.altlinux.lists.devel
    
    
    AGPL code for this site: git clone https://public-inbox.org/public-inbox.git