Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

If you stand on your head, you will get footprints in your hair.


comp / comp.os.linux.misc / Re: How many ways can you run a script?

SubjectAuthor
* Re: How many ways can you run a script?Fritz Wuehler
+- Re: How many ways can you run a script?Fritz Wuehler
`* Re: How many ways can you run a script?Woozy Song
 `- Re: How many ways can you run a script?Nuno Silva

1
Subject: Re: How many ways can you run a script?
From: Fritz Wuehler
Newsgroups: comp.os.linux.misc
Organization: dizum.com - The Internet Problem Provider
Date: Thu, 30 May 2024 01:14 UTC
References: 1
From: fritz@spamexpire-202405.rodent.frell.theremailer.net (Fritz Wuehler)
Subject: Re: How many ways can you run a script?
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
References: <v372oq462c@dont-email.me>
Message-ID: <db9f509a5abb8d9eed3291ea7c7d27cb@msgid.frell.theremailer.net>
Date: Thu, 30 May 2024 03:14:31 +0200
Newsgroups: comp.os.linux.misc
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.mixmin.net!news2.arglkargh.de!alphared!sewer!news.dizum.net!not-for-mail
Organization: dizum.com - The Internet Problem Provider
X-Abuse: abuse@dizum.com
Injection-Info: sewer.dizum.com - 2001::1/128
View all headers

Woozy Song <suzyw...@outlook.com> [WS]:
WS> I know these are not all equivalent and may have idiosyncracies.

Idiosyncracies is shell's middle name.
Use them or lose them, as they say...

$ ${0/-} myscript

(assuming that this is a login tty and your shell is bash)

Subject: Re: How many ways can you run a script?
From: Woozy Song
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sun, 2 Jun 2024 01:34 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: suzyw0ng@outlook.com (Woozy Song)
Newsgroups: comp.os.linux.misc
Subject: Re: How many ways can you run a script?
Date: Sun, 2 Jun 2024 09:34:09 +0800
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <v3gi6h$31val$2@dont-email.me>
References: <v372oq462c@dont-email.me>
<db9f509a5abb8d9eed3291ea7c7d27cb@msgid.frell.theremailer.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 02 Jun 2024 03:34:09 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="1a19dff93a068eed1274155c788ce227";
logging-data="3210581"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3wpqQVL5DVLErpVjV16h4VlxqaXkU9Vs="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.2
Cancel-Lock: sha1:u9N3CJGJ8DgcIjfZ5YEylSjn3nA=
In-Reply-To: <db9f509a5abb8d9eed3291ea7c7d27cb@msgid.frell.theremailer.net>
View all headers

Fritz Wuehler wrote:
> Woozy Song <suzyw...@outlook.com> [WS]:
> WS> I know these are not all equivalent and may have idiosyncracies.
>
> Idiosyncracies is shell's middle name.
> Use them or lose them, as they say...
>
> $ ${0/-} myscript
>
> (assuming that this is a login tty and your shell is bash)
>

That is an obscure one! What does the /- mean?

Subject: Re: How many ways can you run a script?
From: Nuno Silva
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sun, 2 Jun 2024 10:48 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nunojsilva@invalid.invalid (Nuno Silva)
Newsgroups: comp.os.linux.misc
Subject: Re: How many ways can you run a script?
Date: Sun, 02 Jun 2024 11:48:19 +0100
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <v3hilj$3ajff$1@dont-email.me>
References: <v372oq462c@dont-email.me>
<db9f509a5abb8d9eed3291ea7c7d27cb@msgid.frell.theremailer.net>
<v3gi6h$31val$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 02 Jun 2024 12:48:19 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="476291a4c95d43f7017e90d5ec77f31d";
logging-data="3493359"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+J0MXaXwBzCdTnbP5Zb4nc"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
Cancel-Lock: sha1:KFCjg3ZtizO/MgwCnVM0+pHdWYs=
View all headers

On 2024-06-02, Woozy Song wrote:

> Fritz Wuehler wrote:
>> Woozy Song <suzyw...@outlook.com> [WS]:
>> WS> I know these are not all equivalent and may have idiosyncracies.
>>
>> Idiosyncracies is shell's middle name.
>> Use them or lose them, as they say...
>>
>> $ ${0/-} myscript
>>
>> (assuming that this is a login tty and your shell is bash)
>>
>
> That is an obscure one! What does the /- mean?

I'm guessing it's "delete all matches of '-' in $0"?

See «'${PARAMETER/PATTERN/STRING}'» in

info '(bash)Shell Parameter Expansion'

--
Nuno Silva

Subject: Re: How many ways can you run a script?
From: Fritz Wuehler
Newsgroups: comp.os.linux.misc
Organization: dizum.com - The Internet Problem Provider
Date: Sun, 2 Jun 2024 11:57 UTC
References: 1 2 3
From: fritz@spamexpire-202406.rodent.frell.theremailer.net (Fritz Wuehler)
Subject: Re: How many ways can you run a script?
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
References: <v372oq462c@dont-email.me>
<db9f509a5abb8d9eed3291ea7c7d27cb@msgid.frell.theremailer.net>
<v3gi6h1val@dont-email.me>
Message-ID: <01c5bbc6ffa97ded366d2abf4651b36b@msgid.frell.theremailer.net>
Date: Sun, 02 Jun 2024 13:57:56 +0200
Newsgroups: comp.os.linux.misc
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.swapon.de!news.in-chemnitz.de!news2.arglkargh.de!alphared!sewer!news.dizum.net!not-for-mail
Organization: dizum.com - The Internet Problem Provider
X-Abuse: abuse@dizum.com
Injection-Info: sewer.dizum.com - 2001::1/128
View all headers

Woozy Song <suzyw...@outlook.com> [WS]:
WS> >$ ${0/-} myscript
WS> What does the /- mean?

Get rid of a possible (initial) "-" in $0:

$ echo $0; echo ${0/-}
-/bin/bash
/bin/bash

1

rocksolid light 0.9.8
clearnet tor