open command & xdg-open command & Ubuntu?
Hi, I found the command open, then xdg-open ... both do the same, I use Lubuntu, so when I should use one and when should use another?
and how do I use the flag -a for open any web (https://ddg.com for example) using another browser that is NOT my default browser (=Falkon) like Chromium browser? the command is ....
Thank you and Regards!
https://redd.it/1dfm340
@r_bash
Hi, I found the command open, then xdg-open ... both do the same, I use Lubuntu, so when I should use one and when should use another?
and how do I use the flag -a for open any web (https://ddg.com for example) using another browser that is NOT my default browser (=Falkon) like Chromium browser? the command is ....
Thank you and Regards!
https://redd.it/1dfm340
@r_bash
Official page
Hey guys, someone be so kind to write me in a reply the official bash page to find the noscripting manual and one or another link you can think of, containing tips on noscripting.
https://redd.it/1dg4awa
@r_bash
Hey guys, someone be so kind to write me in a reply the official bash page to find the noscripting manual and one or another link you can think of, containing tips on noscripting.
https://redd.it/1dg4awa
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
POSIX 2024 published: $'...' strings, set -o pipefail, find -0, xargs -0, sed -E, readlink, realpath, and more becoming new standards
# [1003.1-2024 - IEEE/Open Group Standard for Information Technology--Portable Operating System Interface (POSIX™) Base Specifications, Issue 8](https://ieeexplore.ieee.org/document/10555529)
Non-paywalled specification should eventually replace the current documentation [here at opengroup.org](https://pubs.opengroup.org/onlinepubs/9699919799/).
[HN thread](https://news.ycombinator.com/item?id=40679809)
Highlights on HN from [a-french-anon](https://news.ycombinator.com/threads?id=a-french-anon):
> * readlink/realpath (https://austingroupbugs.net/view.php?id=1457)
>
> * find -print0, xargs -0 and read -d (https://austingroupbugs.net/view.php?id=243)
>
> * find -iname (https://austingroupbugs.net/view.php?id=1031)
>
> * sed -E (https://austingroupbugs.net/view.php?id=528)
>
> * set -o pipefail (https://austingroupbugs.net/view.php?id=789)
Perhaps not strictly bash-related, but a rising tide lifts all boats.
https://redd.it/1dgbdp4
@r_bash
# [1003.1-2024 - IEEE/Open Group Standard for Information Technology--Portable Operating System Interface (POSIX™) Base Specifications, Issue 8](https://ieeexplore.ieee.org/document/10555529)
Non-paywalled specification should eventually replace the current documentation [here at opengroup.org](https://pubs.opengroup.org/onlinepubs/9699919799/).
[HN thread](https://news.ycombinator.com/item?id=40679809)
Highlights on HN from [a-french-anon](https://news.ycombinator.com/threads?id=a-french-anon):
> * readlink/realpath (https://austingroupbugs.net/view.php?id=1457)
>
> * find -print0, xargs -0 and read -d (https://austingroupbugs.net/view.php?id=243)
>
> * find -iname (https://austingroupbugs.net/view.php?id=1031)
>
> * sed -E (https://austingroupbugs.net/view.php?id=528)
>
> * set -o pipefail (https://austingroupbugs.net/view.php?id=789)
Perhaps not strictly bash-related, but a rising tide lifts all boats.
https://redd.it/1dgbdp4
@r_bash
Templating in Bash, but not $foo
In a bash noscript I have a string containing a lot of dollar signs: 'asdf $ ... $'.
I want to insert a variable into that string. But if I use "..." instead of single quotes, then I need to escape all dollar signs (which I would like to avoid).
Is there a way to keep the dollar signs and insert a variable into a string?
Is there a simple templating solution like {{myvar}}?
https://redd.it/1dgdkpc
@r_bash
In a bash noscript I have a string containing a lot of dollar signs: 'asdf $ ... $'.
I want to insert a variable into that string. But if I use "..." instead of single quotes, then I need to escape all dollar signs (which I would like to avoid).
Is there a way to keep the dollar signs and insert a variable into a string?
Is there a simple templating solution like {{myvar}}?
https://redd.it/1dgdkpc
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Word Splitting definition from man page confusing
This is from the man page of bash (5.2):
>If IFS is unset, or its value is exactly <space><tab><newline>, the default,
then sequences of <space>, <tab>, and <newline> at the beginning and end
of the results of the previous expansions are ignored, and any sequence of
IFS characters not at the beginning or end serves to delimit words.
According to that, I would expect this following behaviour:
$ A=" one two "
$ echo before-$A-after
before-one two-after
However, the actual output is:
before- one two -after
As you can see, the IFS whitespace at the beginning and end of the result of the previous expansion was NOT ignored, precisely the opposite of what the man page proclaims.
Is there something I misunderstood?
https://redd.it/1dgi39w
@r_bash
This is from the man page of bash (5.2):
>If IFS is unset, or its value is exactly <space><tab><newline>, the default,
then sequences of <space>, <tab>, and <newline> at the beginning and end
of the results of the previous expansions are ignored, and any sequence of
IFS characters not at the beginning or end serves to delimit words.
According to that, I would expect this following behaviour:
$ A=" one two "
$ echo before-$A-after
before-one two-after
However, the actual output is:
before- one two -after
As you can see, the IFS whitespace at the beginning and end of the result of the previous expansion was NOT ignored, precisely the opposite of what the man page proclaims.
Is there something I misunderstood?
https://redd.it/1dgi39w
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How can one reliably output text, if it contains text from variable expansions?
I want a command to easily print out text, that may include text from a variable expansion.
The bash command echo fails for FOO=-n and BAR=bar:
$ echo "$FOO" "$BAR"
bar$
There is printf, but there you always need to pass a format string, which to me seems to burdensome. One might try a function definition:
$ myecho () { printf %s "$@" ; }
$ echo $FOO $BAR
-nbar$ # space between arguments is missing.
There must be some ready to use solution, right?
https://redd.it/1dgiz6d
@r_bash
I want a command to easily print out text, that may include text from a variable expansion.
The bash command echo fails for FOO=-n and BAR=bar:
$ echo "$FOO" "$BAR"
bar$
There is printf, but there you always need to pass a format string, which to me seems to burdensome. One might try a function definition:
$ myecho () { printf %s "$@" ; }
$ echo $FOO $BAR
-nbar$ # space between arguments is missing.
There must be some ready to use solution, right?
https://redd.it/1dgiz6d
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Why does ">> " result in ambiguous redirect
In a folder i have 3 files : file1 file2 file3
Doing "date >> ./" Causes error "ambiguous redirect.
https://redd.it/1dh4fpd
@r_bash
In a folder i have 3 files : file1 file2 file3
Doing "date >> ./" Causes error "ambiguous redirect.
https://redd.it/1dh4fpd
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Script for doing the command line labor in making and adding to a github repository
It's very simple as far as software is concerned, mostly just designed it for myself just because i think making commits to github is kinda annoying:
https://github.com/LEDparty/lazy-commit
Tested and works like it should.
https://redd.it/1dhd2zb
@r_bash
It's very simple as far as software is concerned, mostly just designed it for myself just because i think making commits to github is kinda annoying:
https://github.com/LEDparty/lazy-commit
Tested and works like it should.
https://redd.it/1dhd2zb
@r_bash
GitHub
GitHub - LEDparty/lazy-commit: Reduces effort and work for initializing and pushing changes for a repository. Attempts to push…
Reduces effort and work for initializing and pushing changes for a repository. Attempts to push all changes instead of targeting individual files. - LEDparty/lazy-commit
MarCLIdown: A decent way to read markdown files directly in your linux terminal.
MarCLIdown (WIP) is a minimalist Bash program that prints a Markdown file with a beautiful, human-readable monochrome output, featuring interactive images, hyperlinks, emails, and references, as well as noscripts, emphasis, strikethrough, highlighted text, and Unicode characters for easy recognition of elements such as lists, checkboxes, collapsible sections, notes, etc.
https://preview.redd.it/5fz9y399y07d1.png?width=1365&format=png&auto=webp&s=d86457db474f9f75c760ede62ab877fe6fe284d9
I don't have much knowledge of programming, so there's still a lot to improve in the code, as well as finishing the planned features.
What do you think? And what extra formatting could this support? Any good github flavor feature I forgot about?
https://redd.it/1dhl7ij
@r_bash
MarCLIdown (WIP) is a minimalist Bash program that prints a Markdown file with a beautiful, human-readable monochrome output, featuring interactive images, hyperlinks, emails, and references, as well as noscripts, emphasis, strikethrough, highlighted text, and Unicode characters for easy recognition of elements such as lists, checkboxes, collapsible sections, notes, etc.
https://preview.redd.it/5fz9y399y07d1.png?width=1365&format=png&auto=webp&s=d86457db474f9f75c760ede62ab877fe6fe284d9
I don't have much knowledge of programming, so there's still a lot to improve in the code, as well as finishing the planned features.
What do you think? And what extra formatting could this support? Any good github flavor feature I forgot about?
https://redd.it/1dhl7ij
@r_bash
Help with noscript to format markdown tables
Hi, I recently made this post asking for help on how to make hyperlinks in a markdown file appear beautifully in the terminal, as I was making a program similar to glow, I've made a lot of progress (which you can see here) since then, but I just couldn't handle formatting the markdown tables, does anyone know how this could be done using only native linux tools?
https://redd.it/1dhlerj
@r_bash
Hi, I recently made this post asking for help on how to make hyperlinks in a markdown file appear beautifully in the terminal, as I was making a program similar to glow, I've made a lot of progress (which you can see here) since then, but I just couldn't handle formatting the markdown tables, does anyone know how this could be done using only native linux tools?
https://redd.it/1dhlerj
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Manage your noscripts and snippets, share them and run programming languages as noscripts
https://github.com/thereisnotime/xxToolbelt
https://redd.it/1dhk5ps
@r_bash
https://github.com/thereisnotime/xxToolbelt
https://redd.it/1dhk5ps
@r_bash
GitHub
GitHub - thereisnotime/xxToolbelt: Manage your noscripts and snippets, share them and run programming languages as noscripts
Manage your noscripts and snippets, share them and run programming languages as noscripts - thereisnotime/xxToolbelt
Have you ever written a full on application in Bash? What was it?
I'm a very old hat programmer. C++ was newfangled stuff and nobody had ever spoken the word "Javanoscript" when I first learned how to code Hello World. Bsh/Bash was the first language I learned, and we called it "terminal programming" back then and not noscripting.
To this day its my go to if I need to write a linux-portable application that doesn't engage with the hardware enough to require C. I recently "finished" a program for controlling an entire network of remote Varnish server clusters, written in just under 2000 lines. It uses a pull-store-flag-edit-push-versioncontrol schema with 4 levels of granularity in managing .vcl files, and has remote tools built in for generating and pulling logs, modifying inline C include files, and controlling all the cache parameters. It even has a fancy toggling system that lets a non-VCL nerd enable and disable all the special modules, and its own Help menu.
I wrote this beast because I'm the only resident Varnish guru in our devteam, and I needed something simple that other administrators can use to control and maintain the system if I got hit by a bus. At its current line count, and with 28 menus I'm about 80% sure its the biggest Bash program I've written in my life. That got me wondering what kinds of things other people have written as their Magnum Opus.
https://redd.it/1dhsf7u
@r_bash
I'm a very old hat programmer. C++ was newfangled stuff and nobody had ever spoken the word "Javanoscript" when I first learned how to code Hello World. Bsh/Bash was the first language I learned, and we called it "terminal programming" back then and not noscripting.
To this day its my go to if I need to write a linux-portable application that doesn't engage with the hardware enough to require C. I recently "finished" a program for controlling an entire network of remote Varnish server clusters, written in just under 2000 lines. It uses a pull-store-flag-edit-push-versioncontrol schema with 4 levels of granularity in managing .vcl files, and has remote tools built in for generating and pulling logs, modifying inline C include files, and controlling all the cache parameters. It even has a fancy toggling system that lets a non-VCL nerd enable and disable all the special modules, and its own Help menu.
I wrote this beast because I'm the only resident Varnish guru in our devteam, and I needed something simple that other administrators can use to control and maintain the system if I got hit by a bus. At its current line count, and with 28 menus I'm about 80% sure its the biggest Bash program I've written in my life. That got me wondering what kinds of things other people have written as their Magnum Opus.
https://redd.it/1dhsf7u
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Site that returns protocol that can be used from the command line
Is there a site similar to
https://redd.it/1di8umt
@r_bash
Is there a site similar to
ifconfig.me that you can curl so that it returns the protocol it was hit with? I.e. curl http://example.com should return http somewhere in the response and curl https://example.com should return https.https://redd.it/1di8umt
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Write to file keeps service restarting
I am trying to write a simple multi-line value to a file.
I've noticed as I watch the processes, and the logs, whenever I add that particular code and re-start my service, it loops over and over again, instead of running once and then waiting for the timer to re-activate it.
I then execute
And then loop begins. As soon as I remove that particular set of code and re-execute, then the noscript only runs once, and then waits 15 minutes for the
I've tried both
https://redd.it/1did9c7
@r_bash
I am trying to write a simple multi-line value to a file.
I've noticed as I watch the processes, and the logs, whenever I add that particular code and re-start my service, it loops over and over again, instead of running once and then waiting for the timer to re-activate it.
cat ${dir}/${file}.json << EOF
{
"id": "${item_id}",
}
EOF
I then execute
systemctl --user start my_service_name.service
And then loop begins. As soon as I remove that particular set of code and re-execute, then the noscript only runs once, and then waits 15 minutes for the
.timer to call it again.I've tried both
cat and tee hoping one or the other would work.https://redd.it/1did9c7
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
messed up configuration
Hi
i am running tumbleweed and messed up my bashrc (i think).
I followed this guide:
https://christitus.com/beautiful-bash/
i recognized afterwords that a comment says "this wont work on opensuse".
now, everytime i start my terminal, i get an "bash: /home/*user*/.bashrc: Permission denied"
is there a simple way to fix that? or do i have to reverse engineer the sh noscript?
https://redd.it/1djf1od
@r_bash
Hi
i am running tumbleweed and messed up my bashrc (i think).
I followed this guide:
https://christitus.com/beautiful-bash/
i recognized afterwords that a comment says "this wont work on opensuse".
now, everytime i start my terminal, i get an "bash: /home/*user*/.bashrc: Permission denied"
is there a simple way to fix that? or do i have to reverse engineer the sh noscript?
https://redd.it/1djf1od
@r_bash
Christitus
Beautiful Bash
Having Fun with Technology
Anyone help me understand why this string fails regex validation?
This code outputs "bad" instead of "good" even though the regex seems to work fine when tested on regex101.com . Does anyone understand what is wrong?
https://redd.it/1djft6r
@r_bash
This code outputs "bad" instead of "good" even though the regex seems to work fine when tested on regex101.com . Does anyone understand what is wrong?
#!/usr/bin/env bashreadonly serverVer="1.2.3.4"if [[ "$serverVer" =~ ^(?:(\d+)\.)?(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$ ]]; thenecho goodfiecho badhttps://redd.it/1djft6r
@r_bash
regex101
regex101: build, test, and debug regex
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET, Rust.
How would you learn bash noscripting today?
Through the perspective of real practise, after years of practical work, having a lot of experience, how wold you build your mastery of bash noscripting in these days?
*which books?
*video lessons?
*online courses?
*what kind of pet projects or practices?
*any other advices?
Thank you!
https://redd.it/1djhccz
@r_bash
Through the perspective of real practise, after years of practical work, having a lot of experience, how wold you build your mastery of bash noscripting in these days?
*which books?
*video lessons?
*online courses?
*what kind of pet projects or practices?
*any other advices?
Thank you!
https://redd.it/1djhccz
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How to extract certain text from local html files in ubuntu
I have several HTML files saved locally. How can I extract numbers that start with "-" from all of them and save each number in a separate line in a new file? For example, the numbers are formatted like this: - 74345. I want each of these numbers to be placed on a new line in the output file.
https://redd.it/1djqcjs
@r_bash
I have several HTML files saved locally. How can I extract numbers that start with "-" from all of them and save each number in a separate line in a new file? For example, the numbers are formatted like this: - 74345. I want each of these numbers to be placed on a new line in the output file.
https://redd.it/1djqcjs
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
source file counter variable
My post keeps getting removed for my code.
My source file has 4 line is such as
img_1=file1
img_2=file2
I'm trying to write a noscript with a counter to "ls -lh $img_1".... be easier to explain if I could post my code
https://redd.it/1dl8zkx
@r_bash
My post keeps getting removed for my code.
My source file has 4 line is such as
img_1=file1
img_2=file2
I'm trying to write a noscript with a counter to "ls -lh $img_1".... be easier to explain if I could post my code
https://redd.it/1dl8zkx
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community