← prev | next →
Ceda EI 2022-07-19 18:55:09
Shah_baaz2 2022-07-19 18:48:10
So in shell file it should be like this
Myvar=$abc
Or it would be like
Myvar=${abc}
With curly brackets
Both work, the advantage of second one is you can concatenate it with normal strings
thecatvoid 2022-07-19 19:27:04
should i make any variable $foo to “${foo}” ?
thecatvoid 2022-07-19 19:27:05
i guess no down side in using curly braces for most variables
thecatvoid 2022-07-19 19:27:05
$var is exactly the same as ${var}, but imagine if you would need to insert a variable value in the middle of a word or a link:
https://www.some$varlink.com
is it $var? or is it $varlink now? In order to disambiguate the situation and prevent the usage of a wrong variable identifier (because $varlink will be used in this case) you enclose the variable identifier inside curly braces:
https://www.some${var}link.com
thecatvoid 2022-07-19 19:27:06
no, there is no down side. the fact that you would use curly braces on every variable would only add consistency/uniformity to your code
marcotrosi 2022-07-19 19:39:08
thecatvoid 2022-07-19 19:27:06
no, there is no down side. the fact that you would use curly braces on every variable would only add consistency/uniformity to your code
Exactly that. No exceptions. Less thinking required
Shah_baaz2 2022-07-19 20:08:00
Thanks mate i understood it very well thanks alot
Shah_baaz2 2022-07-19 20:09:00
It is just like in windows we uses ” “so that if any folder have spaces in it then it will consider it one name just like that
Kueppo 2022-07-19 22:13:00
Jamerive 2022-07-19 18:19:59
is plan9 an specification or something like that or is it an true os?
plan9 is a real OS, it’s very healthy and has its own utilities, shell(rc), and other stuffs. you can try the ports, I did some stuffs with rc back in the past.
https://archlinux.org/packages/community/x86_64/plan9port/
Kueppo 2022-07-19 22:13:45
But I don’t think it’s worth looking at it now.
Jamerive 2022-07-19 22:35:07
Kueppo 2022-07-19 22:13:45
But I don’t think it’s worth looking at it now.
like in 10 years then?
Kueppo 2022-07-19 22:37:23
😂 dunno depends on what you want, that’s for me, I just stopped doing things for nothing, more objective now.
Captn_Obvious 2022-07-19 23:14:22
Kueppo 2022-07-19 22:13:00
plan9 is a real OS, it’s very healthy and has its own utilities, shell(rc), and other stuffs. you can try the ports, I did some stuffs with rc back in the past.
https://archlinux.org/packages/community/x86_64/plan9port/
When I was younger, I was very exited about Plan9 and Hurd… Now both are being forgotten…
The only “real” thing about Plan9 I have seen recently is the 9p protocol used in KVM
Kueppo 2022-07-19 23:27:38
Captn_Obvious 2022-07-19 23:14:22
When I was younger, I was very exited about Plan9 and Hurd… Now both are being forgotten…
The only “real” thing about Plan9 I have seen recently is the 9p protocol used in KVM
I too, I was very excited about Plan9
Did not know about that, oh that’s cool, just that I forgot everything about it, I don’t even remember that 9p :).
Maybe I’ll try it again(just for fun) when I’m 70(if I’m still alive)? lol I’m just ~ 20.
Kueppo 2022-07-19 23:29:37
fortune was good 🙂
devmsv 2022-07-19 23:55:41
Captn_Obvious 2022-07-19 23:14:22
When I was younger, I was very exited about Plan9 and Hurd… Now both are being forgotten…
The only “real” thing about Plan9 I have seen recently is the 9p protocol used in KVM
Also /proc filesystem is from plan9 AFAIK
smol_mazunki 2022-07-20 00:13:10
marcotrosi 2022-07-19 19:39:08
Exactly that. No exceptions. Less thinking required
in scripts i either use “${var1?mandatory var1 was not set}” or “${var1:-default value}” anyway
smol_mazunki 2022-07-20 00:14:24
good practice I’d say 😛
smol_mazunki 2022-07-20 00:14:49
combined with set -e it’s an easy way to assert vars are set before continuing
michele_pagot 2022-07-20 00:40:56
hi there, I’m investigating an issue on an “external resource” that sometime somehow magically disapears… I like to know when it is deleted. Let say I have a magic command to look at this resource
querythethings | grep “it-is-ok”
my first idea was to use watch and time
time watch –chgexit ‘querythethings | grep “it-is-ok”‘
michele_pagot 2022-07-20 00:42:53
can I do it better?maybe recording the result to file? maybe logging the date and time in place of the duration?
smol_mazunki 2022-07-20 01:04:52
michele_pagot 2022-07-20 00:40:56
hi there, I’m investigating an issue on an “external resource” that sometime somehow magically disapears… I like to know when it is deleted. Let say I have a magic command to look at this resource
querythethings | grep “it-is-ok”
my first idea was to use watch and time
time watch –chgexit ‘querythethings | grep “it-is-ok”‘
ssh 1.2.3.4 test -f /path/to/file
smol_mazunki 2022-07-20 01:05:11
not sure if that’s what you’re asking exactly
smol_mazunki 2022-07-20 01:06:10
there’s also inotify for file changes on the system
smol_mazunki 2022-07-20 01:07:27
inotfiy_add_watch(STDOUT, “path/to/file”, IN_DELETE);
michele_pagot 2022-07-20 01:09:15
no it is not a file, let say it could be something like ‘curl https://something’
smol_mazunki 2022-07-20 01:10:51
while curl -s ‘somesite.com’; do sleep 5; done && date
smol_mazunki 2022-07-20 01:11:33
once curl exits unsuccessfully, it would continue onto &&
michele_pagot 2022-07-20 01:14:28
easy…I like it!!!!! thanks
smol_mazunki 2022-07-20 01:14:37
nice
nrr_us 2022-07-20 02:40:27
Captn_Obvious 2022-07-19 15:18:23
Plan9 ? Is that project still alive?
Most everyone, if they still use the weird research operating system, have moved to 9front. The original Bell Labs distribution doesn’t see a lot of activity.
There’s Plan 9 from User Space in case you want some of the tools natively on Unix.
I ported Inferno, the weird research operating system that thinks it’s a weird virtual machine, to L4 when I should’ve been writing my master’s thesis.
nrr_us 2022-07-20 02:41:21
Jamerive 2022-07-19 18:19:59
is plan9 an specification or something like that or is it an true os?
It was actually an operating system in its own right, meant mostly as a research vehicle.
raytracer9 2022-07-20 04:54:43
@smol_mazunki you seem to use a curl a lot. I only know basics and want to know more of it (actually don’t wanna use a GUI, like postman, insomnia etc.)
Can you point to some resource which tell important things about curl. I need somewhat extensive guide
smol_mazunki 2022-07-20 06:04:23
raytracer9 2022-07-20 04:54:43
@smol_mazunki you seem to use a curl a lot. I only know basics and want to know more of it (actually don’t wanna use a GUI, like postman, insomnia etc.)
Can you point to some resource which tell important things about curl. I need somewhat extensive guide
i only use curl in scripts
martito 2022-07-20 09:22:57
raytracer9 2022-07-20 04:54:43
@smol_mazunki you seem to use a curl a lot. I only know basics and want to know more of it (actually don’t wanna use a GUI, like postman, insomnia etc.)
Can you point to some resource which tell important things about curl. I need somewhat extensive guide
The more you use the tool the more comfortable you’ll feel with it. Also: man curl should be your first source of knowledge.
← prev | next →