Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.misc > #56480 > unrolled thread
| Started by | Fritz Wuehler <fritz@spamexpire-202405.rodent.frell.theremailer.net> |
|---|---|
| First post | 2024-05-30 03:14 +0200 |
| Last post | 2024-06-02 13:57 +0200 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.os.linux.misc
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: How many ways can you run a script? Fritz Wuehler <fritz@spamexpire-202405.rodent.frell.theremailer.net> - 2024-05-30 03:14 +0200
Re: How many ways can you run a script? Woozy Song <suzyw0ng@outlook.com> - 2024-06-02 09:34 +0800
Re: How many ways can you run a script? Nuno Silva <nunojsilva@invalid.invalid> - 2024-06-02 11:48 +0100
Re: How many ways can you run a script? Fritz Wuehler <fritz@spamexpire-202406.rodent.frell.theremailer.net> - 2024-06-02 13:57 +0200
| From | Fritz Wuehler <fritz@spamexpire-202405.rodent.frell.theremailer.net> |
|---|---|
| Date | 2024-05-30 03:14 +0200 |
| Subject | Re: How many ways can you run a script? |
| Message-ID | <db9f509a5abb8d9eed3291ea7c7d27cb@msgid.frell.theremailer.net> |
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)
[toc] | [next] | [standalone]
| From | Woozy Song <suzyw0ng@outlook.com> |
|---|---|
| Date | 2024-06-02 09:34 +0800 |
| Message-ID | <v3gi6h$31val$2@dont-email.me> |
| In reply to | #56480 |
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?
[toc] | [prev] | [next] | [standalone]
| From | Nuno Silva <nunojsilva@invalid.invalid> |
|---|---|
| Date | 2024-06-02 11:48 +0100 |
| Message-ID | <v3hilj$3ajff$1@dont-email.me> |
| In reply to | #56499 |
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
[toc] | [prev] | [next] | [standalone]
| From | Fritz Wuehler <fritz@spamexpire-202406.rodent.frell.theremailer.net> |
|---|---|
| Date | 2024-06-02 13:57 +0200 |
| Message-ID | <01c5bbc6ffa97ded366d2abf4651b36b@msgid.frell.theremailer.net> |
| In reply to | #56480 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.os.linux.misc
csiph-web