🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #3977

A mystery of /bin/sh -c

#3977
From: Masahiro Yanagisawa
Date: Wed, 28 Sep 1994 09:04
31 lines
2137 bytes


Hi,
Can someone explain why the "-c" option of /bin/sh  behaves strangely ?

hp-ux>   ksh  		-c 'echo $*' 1 2 3 4 5
1 2 3 4 5
hp-ux>   (posix) sh	-c 'echo $*' 1 2 3 4 5
1 2 3 4 5
sunos4>  /bin/csh  -f	-c 'echo $*' 1 2 3 4 5
1 2 3 4 5
sunos4>	 /bin/su - any  -c 'echo $*' 1 2 3 4 5
1 2 3 4 5
sunos4>	 /bin/su   any  -c 'echo $*' 1 2 3 4 5
1 2 3 4 5


But,

hp-ux>   /bin/sh -c 'echo $*' 1 2 3 4 5
2 3 4 5
sunos4>  /bin/sh -c 'echo $*' 1 2 3 4 5
2 3 4 5

sunos4>  /bin/sh -c 'echo $0 $*' 1 2 3 4 5
1 2 3 4 5

..........why??   Can I find the reason in some FAQ articles ?
Masahiro Yanagisawa <masahiro@barclays.co.jp>
BARCLAYS SERVICES (JAPAN) LIMITED.
Technical Details
Message-ID: <masahiro.94Sep28175708@barclays.co.jp>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!news.gdbnet.ad.jp!sinetnews!news.u-tokyo.ac.jp!wnoc-tyo-news!news.iij.ad.jp!iijnet!bsjlgw!nextgw!sushi!maserati!s5!masahiro

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1045ef,66716f2733cecf68,start
X-Google-Attributes: gid1045ef,public
X-Google-Thread: f8c9b,66716f2733cecf68,start
X-Google-Attributes: gidf8c9b,public
X-Google-Thread: fcfb5,66716f2733cecf68,start
X-Google-Attributes: gidfcfb5,public
X-Google-Thread: 1070f0,66716f2733cecf68,start
X-Google-Attributes: gid1070f0,public
X-Google-Thread: 1012a6,66716f2733cecf68,start
X-Google-Attributes: gid1012a6,public
X-Google-Thread: 1020c6,66716f2733cecf68,start
X-Google-Attributes: gid1020c6,public
X-Google-Thread: fe657,66716f2733cecf68,start
X-Google-Attributes: gidfe657,public
X-Google-Thread: fcda7,66716f2733cecf68,start
X-Google-Attributes: gidfcda7,public
X-Google-ArrivalTime: 1994-09-28 06:04:28 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!news.gdbnet.ad.jp!sinetnews!news.u-tokyo.ac.jp!wnoc-tyo-news!news.iij.ad.jp!iijnet!bsjlgw!nextgw!sushi!maserati!s5!masahiro
From: masahiro@barclays.co.jp (Masahiro Yanagisawa)
Newsgroups: comp.unix.shell,comp.unix.questions,comp.unix.admin,comp.sys.sun.admin,comp.sys.hp.hpux,tnn.sys.sun,fj.sys.hp,fj.sys.sun,fj.questions.unix,fj.unix
Subject: A mystery of  /bin/sh -c
Message-ID: <masahiro.94Sep28175708@barclays.co.jp>
Date: 28 Sep 94 09:04:32 GMT
Sender: news@bsjlgw.barclays.co.jp
Followup-To: comp.unix.shell
Organization: Barclays Services (Japan) Limited.
Lines: 32
X-Nntp-Posting-Host: itdtw013
Originator: root@itdtw013