If one number is larger than the other, then... Shellcheck gives me an error that isn't there
In my noscript, I have a directory that if sizes are bigger than 2 MB must show me a message.
My function (the one that works for me):
APPSIZE=$(du -s -- $APPSPATH/$arg | cut -f1 -d" ")
SCRIPTSIZELIMIT="2048"
if [ "$APPSIZE" < "$SCRIPTSIZELIMIT" ]; then
the error that Shellcheck reports:
< is for string comparisons. Use -lt instead.
but if I try using -lt, or -gt or (( )) instead of [[ \]\] or any other solution around the forums... I get error messages.
I don't understand. "Comparison" is what I need, and "-lt" does not work for me.
https://redd.it/1d2pkg6
@r_bash
In my noscript, I have a directory that if sizes are bigger than 2 MB must show me a message.
My function (the one that works for me):
APPSIZE=$(du -s -- $APPSPATH/$arg | cut -f1 -d" ")
SCRIPTSIZELIMIT="2048"
if [ "$APPSIZE" < "$SCRIPTSIZELIMIT" ]; then
the error that Shellcheck reports:
< is for string comparisons. Use -lt instead.
but if I try using -lt, or -gt or (( )) instead of [[ \]\] or any other solution around the forums... I get error messages.
I don't understand. "Comparison" is what I need, and "-lt" does not work for me.
https://redd.it/1d2pkg6
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Reading and writing a USB drive connected to a Linux server using Termux, termux-usb, usbredirect, and QEMU on a smartphone that is not rooted [Alpine Linux operating system, Android operating system]
https://gist.github.com/NoteAfterNote/7a197233de3d60ff1e23ca90ed2f595a
https://redd.it/1d2ywj2
@r_bash
https://gist.github.com/NoteAfterNote/7a197233de3d60ff1e23ca90ed2f595a
https://redd.it/1d2ywj2
@r_bash
Gist
Reading and writing a USB drive connected to a Linux server using Termux, termux-usb, usbredirect, and QEMU on a smartphone that…
Reading and writing a USB drive connected to a Linux server using Termux, termux-usb, usbredirect, and QEMU on a smartphone that is not rooted - note-after-note-2024-may-19-termux-usbredirect-qemu.md
Build the latest GCC versions 10-14 on Debian-based OS
You can build the latest versions of GCC 10,11,12,13,14. The noscript finds the correct download links automatically.
The noscript also installs an autoconf version 2.69 in the GCC build directory which is required to install GCC so it's even easier to use. This is done so it does not overwrite your APT package manager or any manual installs that you have.
I would have made this universal but I don't have fast access to REHL and Arch lacks for nothing so I targeted what I use which is Debian-based OS.
Just run the noscript and enter a few choices and you're off.
You can find this here on GitHub.
# Installation Info
This will install the specific GCC version in this folder
# Disclaimer
The SUDO command is INSIDE the noscript where it is required. Feel free to notice the commands that use them for anyone who is cautious (I understand). It is not a good practice to run all commands as root and it can even mess up the noscript sometimes depending on what is written in it. So I had to go this route.
# Execution
chmod +x build-gcc.sh
./build-gcc.sh
# Optional Settings
I prefer to run my noscript using verbose mode. You can turn this on by changing
Have a great day everyone.
https://redd.it/1d3zeaf
@r_bash
You can build the latest versions of GCC 10,11,12,13,14. The noscript finds the correct download links automatically.
The noscript also installs an autoconf version 2.69 in the GCC build directory which is required to install GCC so it's even easier to use. This is done so it does not overwrite your APT package manager or any manual installs that you have.
I would have made this universal but I don't have fast access to REHL and Arch lacks for nothing so I targeted what I use which is Debian-based OS.
Just run the noscript and enter a few choices and you're off.
You can find this here on GitHub.
# Installation Info
This will install the specific GCC version in this folder
/usr/local/gcc-VERSION so if you ever want to delete it delete the corresponding folder.# Disclaimer
The SUDO command is INSIDE the noscript where it is required. Feel free to notice the commands that use them for anyone who is cautious (I understand). It is not a good practice to run all commands as root and it can even mess up the noscript sometimes depending on what is written in it. So I had to go this route.
# Execution
chmod +x build-gcc.sh
./build-gcc.sh
# Optional Settings
I prefer to run my noscript using verbose mode. You can turn this on by changing
verbose=0 to verbose=1 otherwise there is virtually no output during the build.Have a great day everyone.
https://redd.it/1d3zeaf
@r_bash
GitHub
noscript-repo/Bash/Installer Scripts/GNU Software/build-gcc.sh at main · slyfox1186/noscript-repo
My personal noscript repository with multiple languages supported. AHK v1+v2 | BASH | BATCH | JSON | PERL | POWERSHELL | PYTHON | WINDOWS REGISTRY | XML - slyfox1186/noscript-repo
Help with converting Windows BAT file to bash noscript.
Hi all,
I'm running Linux Mint Mate 21.3 Virginia and I'm trying to convert a series of Windows BAT files that are for an old FPGA programmer I have. The IDE portion of the software runs in Linux but the uploader to the board is a series of BAT noscripts. I'm trying to convert them to .sh files, but I'm having really basic errors.
Firstly, the first line of my .sh file is:
#! /usr/bin/bash
However, when I execute the file I get the following error:
bash: ./program.sh: /usr/bin/bash^M: bad interpreter: No such file or directory
I'm guessing that I have something setup incorrectly in xed so that it's appending the \^M character to the carriage return, but I'm not sure how to fix it. The bash location is correct.
$ which bash
/usr/bin/bash
Any help appreciated.
https://redd.it/1d43lp8
@r_bash
Hi all,
I'm running Linux Mint Mate 21.3 Virginia and I'm trying to convert a series of Windows BAT files that are for an old FPGA programmer I have. The IDE portion of the software runs in Linux but the uploader to the board is a series of BAT noscripts. I'm trying to convert them to .sh files, but I'm having really basic errors.
Firstly, the first line of my .sh file is:
#! /usr/bin/bash
However, when I execute the file I get the following error:
bash: ./program.sh: /usr/bin/bash^M: bad interpreter: No such file or directory
I'm guessing that I have something setup incorrectly in xed so that it's appending the \^M character to the carriage return, but I'm not sure how to fix it. The bash location is correct.
$ which bash
/usr/bin/bash
Any help appreciated.
https://redd.it/1d43lp8
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
What key is M in yhis shortcut? forward-word (M-f) ¶
Hi, I'd like to know what is the key M in M-f
Thank you!
https://redd.it/1d4gcye
@r_bash
Hi, I'd like to know what is the key M in M-f
Thank you!
https://redd.it/1d4gcye
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Oh-My-bash colours problem
Hello everyone 👋
Some time ago I decided to jump on bash terminal. Mostly I use it as is with default settings but now I find Oh-my-bash extension what sounds great because of customisation possibilities.
Now, I have installed Oh-My-Bash and there is few problems with it.
First one is with directory colours. When I set some theme in .bashrc file and restart it source .bashrc, theme have effect on „main” info in console like on date, time, or current location. But for example when I’m in home (or whatever) and do ls/ll the directories funded by this command have white colour, the same as .txt file, or even executable .sh files. How I can resolve this problem?
Second one is with theme colour itself. Most of my app have set specific colour palette and in this case also I would like to use the same colour palette.
I know that oh-my-bash have GitHub page and pretty well done documentation but they do not explain this topic very well. So there is my second question, how I can customise one of themes and change colours in this?
P.S
When I copy one of themes to .oh-my-bash/custom/themes and then set this as variable in .bashrc the theme has no effect. It’s looks like bash don’t even look in custom directory.
Thanks for every response 👍🏻
https://redd.it/1d4nemp
@r_bash
Hello everyone 👋
Some time ago I decided to jump on bash terminal. Mostly I use it as is with default settings but now I find Oh-my-bash extension what sounds great because of customisation possibilities.
Now, I have installed Oh-My-Bash and there is few problems with it.
First one is with directory colours. When I set some theme in .bashrc file and restart it source .bashrc, theme have effect on „main” info in console like on date, time, or current location. But for example when I’m in home (or whatever) and do ls/ll the directories funded by this command have white colour, the same as .txt file, or even executable .sh files. How I can resolve this problem?
Second one is with theme colour itself. Most of my app have set specific colour palette and in this case also I would like to use the same colour palette.
I know that oh-my-bash have GitHub page and pretty well done documentation but they do not explain this topic very well. So there is my second question, how I can customise one of themes and change colours in this?
P.S
When I copy one of themes to .oh-my-bash/custom/themes and then set this as variable in .bashrc the theme has no effect. It’s looks like bash don’t even look in custom directory.
Thanks for every response 👍🏻
https://redd.it/1d4nemp
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Impossible bash prompt?
I'm in the process of customizing my bash prompt. I added an approx. measure of elapsed time (see the picture). However, I'd love to hide this when there is no stdout (see the red arrow). However, the longer I try the more I feel this is impossible. Does someone has an idea how I could manage to get this working?
https://preview.redd.it/yuu2lep4sq3d1.png?width=540&format=png&auto=webp&s=489dd94971b62e5e07c9a1d122446006b95efcbc
https://redd.it/1d4sp77
@r_bash
I'm in the process of customizing my bash prompt. I added an approx. measure of elapsed time (see the picture). However, I'd love to hide this when there is no stdout (see the red arrow). However, the longer I try the more I feel this is impossible. Does someone has an idea how I could manage to get this working?
https://preview.redd.it/yuu2lep4sq3d1.png?width=540&format=png&auto=webp&s=489dd94971b62e5e07c9a1d122446006b95efcbc
https://redd.it/1d4sp77
@r_bash
Generate random ipv6 unique local address
I use the following website for generating ipv6 local addresses: https://unique-local-ipv6.com/
I would love to use a posix shell noscript instead though. Are there any pre-existing tools or methods to do this?
Thank you
https://redd.it/1d50zkh
@r_bash
I use the following website for generating ipv6 local addresses: https://unique-local-ipv6.com/
I would love to use a posix shell noscript instead though. Are there any pre-existing tools or methods to do this?
Thank you
https://redd.it/1d50zkh
@r_bash
Unique-Local-Ipv6
Unique Local IPv6 Generator
Generate unique local IPv6 address blocks (Unique Local Addresses, ULAs) instantly with JavaScript.
Many open issues for ble.sh (bash line editor)
I see a lot of open issues in ble.sh:
https://github.com/akinomyoga/ble.sh/issues
Up to now I have not used the bash line editor.
But it looks good.
Do you recommend ble.sh or do you suggest using an alternative?
Update: Looking at the Contributor page of ble.sh at Github makes me sad. There is only one person working on that project. I guess it is time to realize that for interactive usage a different tool might be better. Follow-up: From Bash to Fish?
https://redd.it/1d52uu3
@r_bash
I see a lot of open issues in ble.sh:
https://github.com/akinomyoga/ble.sh/issues
Up to now I have not used the bash line editor.
But it looks good.
Do you recommend ble.sh or do you suggest using an alternative?
Update: Looking at the Contributor page of ble.sh at Github makes me sad. There is only one person working on that project. I guess it is time to realize that for interactive usage a different tool might be better. Follow-up: From Bash to Fish?
https://redd.it/1d52uu3
@r_bash
GitHub
Issues · akinomyoga/ble.sh
Bash Line Editor―a line editor written in pure Bash with syntax highlighting, auto suggestions, vim modes, etc. for Bash interactive sessions. - Issues · akinomyoga/ble.sh
From Bash to Fish?
I use the Bash for more than 20 years.
I like the Bash shell. I write noscripts with:
And this helps me to automate many things.
But looking at ble.sh (previous reddit post about ble.sh) somehow makes me cry. It looks good, but there is only one maintainer.
While Bash is great for noscripting, it seems to be outdated for interactive usage.
I looked at Fish, and I like it.
How do you feel about that? Do you use Fish? Do you use it for noscripting, too?
https://redd.it/1d53k9o
@r_bash
I use the Bash for more than 20 years.
I like the Bash shell. I write noscripts with:
trap 'echo "ERROR: A command has failed. Exiting the noscript. Line was ($0:$LINENO): $(sed -n "${LINENO}p" "$0")"; exit 3' ERR
set -Eeuo pipefail
And this helps me to automate many things.
But looking at ble.sh (previous reddit post about ble.sh) somehow makes me cry. It looks good, but there is only one maintainer.
While Bash is great for noscripting, it seems to be outdated for interactive usage.
I looked at Fish, and I like it.
How do you feel about that? Do you use Fish? Do you use it for noscripting, too?
https://redd.it/1d53k9o
@r_bash
Reddit
From the bash community on Reddit: Many open issues for ble.sh (bash line editor)
Explore this post and more from the bash community
Time
Hello, i need help when it comes to create noscript that comparise changes between actual time and last time when i runned the noscript. How can i edit prevtime variable to make this works?
curtime=$(date "+%Y-%m-%d %H:%M:%S")
prevtime=$(cat last_run_time.txt)
echo $curtime > last_run_time.txt
echo $prevtime > last_run_time_previous.txt
https://redd.it/1d5a7or
@r_bash
Hello, i need help when it comes to create noscript that comparise changes between actual time and last time when i runned the noscript. How can i edit prevtime variable to make this works?
curtime=$(date "+%Y-%m-%d %H:%M:%S")
prevtime=$(cat last_run_time.txt)
echo $curtime > last_run_time.txt
echo $prevtime > last_run_time_previous.txt
https://redd.it/1d5a7or
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
A bash random word generator with huge english dictionaries
I mostly just think of this as a toy for entertainment, I have used it some over the past couple of years. However, it does have its creative and practical uses. It was just a reaction to the fact that online, I have seen random word generators, and they didn't show me any words I was unfamiliar with.
Link to repository:
https://github.com/LEDparty/bash-rwg/tree/main
https://redd.it/1d5awsb
@r_bash
I mostly just think of this as a toy for entertainment, I have used it some over the past couple of years. However, it does have its creative and practical uses. It was just a reaction to the fact that online, I have seen random word generators, and they didn't show me any words I was unfamiliar with.
Link to repository:
https://github.com/LEDparty/bash-rwg/tree/main
https://redd.it/1d5awsb
@r_bash
GitHub
GitHub - LEDparty/bash-rwg: A random word generator for the linux command line that can generate words or names.
A random word generator for the linux command line that can generate words or names. - LEDparty/bash-rwg
Trouble passing names of files to pdftk
Hi guys I'm trying to merge some pdf files into one with pdftk. So I'm doing a basic grep and formating the output but pdftk keeps trying to open a a file that does not exists.
the noscript is
if I have a file like 'My file' pdftk will try to open My\\ but obviusly it does not exists... So any Idea of why that happens???
https://redd.it/1d5on70
@r_bash
Hi guys I'm trying to merge some pdf files into one with pdftk. So I'm doing a basic grep and formating the output but pdftk keeps trying to open a a file that does not exists.
the noscript is
pdftk $(ls | grep ".pdf$" | sed 's/ /\\ /g' | tr '\n' ' ') cat output test_new.pdfif I have a file like 'My file' pdftk will try to open My\\ but obviusly it does not exists... So any Idea of why that happens???
https://redd.it/1d5on70
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How does mapfile differentiate between a new line and a trailling new line?
https://redd.it/1d6l013
@r_bash
https://redd.it/1d6l013
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Trying to use fim to display a jpeg ...
I've written a service file that runs at boot on an Orange Pi5 plus. Basically it checks to see if /dev/video0 is available, and when it is it calls a noscript that takes the signal from HDMI in (/dev/video0), crops it and puts it out on /dev/video1 using ffmpeg & ffplay. It all works really well, and handles the HDMI in lead being unplugged and plugged back in with no problem.
What I'm having a problem with is fim. In the terminal I can type:
fim unnoscriptd.jpg
and it puts that into the frame buffer of the console, in this case /dev/video1 so that it displays the jpeg whenever the input HDMI cable is unplugged. My problem is, when I put the same command into the service file, it exits with exit code 252 or if I put the same command into my noscript, it just doesn't work. It doesn't exit from the noscript, which is good, but it doesn't display the jpeg on the console either. I'm pretty sure its some kind of permission thing, but the .sh file has been chmod +x <filename> and I've checked the permissions with ls -l <filename> and all looks good. As I said, ffmpeg/ffplay, which are both root:root work fine. I don't get why fim doesn't just display. I've been going around in circles for a few days now!
https://redd.it/1d6prkh
@r_bash
I've written a service file that runs at boot on an Orange Pi5 plus. Basically it checks to see if /dev/video0 is available, and when it is it calls a noscript that takes the signal from HDMI in (/dev/video0), crops it and puts it out on /dev/video1 using ffmpeg & ffplay. It all works really well, and handles the HDMI in lead being unplugged and plugged back in with no problem.
What I'm having a problem with is fim. In the terminal I can type:
fim unnoscriptd.jpg
and it puts that into the frame buffer of the console, in this case /dev/video1 so that it displays the jpeg whenever the input HDMI cable is unplugged. My problem is, when I put the same command into the service file, it exits with exit code 252 or if I put the same command into my noscript, it just doesn't work. It doesn't exit from the noscript, which is good, but it doesn't display the jpeg on the console either. I'm pretty sure its some kind of permission thing, but the .sh file has been chmod +x <filename> and I've checked the permissions with ls -l <filename> and all looks good. As I said, ffmpeg/ffplay, which are both root:root work fine. I don't get why fim doesn't just display. I've been going around in circles for a few days now!
https://redd.it/1d6prkh
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Right Prompt feature
Is there a way to get the "Right-prompt" feature in bash without using the "ble.sh" framework?
https://redd.it/1d70txn
@r_bash
Is there a way to get the "Right-prompt" feature in bash without using the "ble.sh" framework?
https://redd.it/1d70txn
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Opening the terminal from tje noscript file
hi, sometimes i have ro run a command to connect to vpn and then enter the password (not sudo password)
I wanted to create a .sh file that will connect after asking for password.
if i just create the bash file with the connect command then of course no window will open, how can i change the .sh file to open a terminal and continue like the connect command was typed?
https://redd.it/1d7f38j
@r_bash
hi, sometimes i have ro run a command to connect to vpn and then enter the password (not sudo password)
I wanted to create a .sh file that will connect after asking for password.
if i just create the bash file with the connect command then of course no window will open, how can i change the .sh file to open a terminal and continue like the connect command was typed?
https://redd.it/1d7f38j
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Intern Scripting Help
Hi All,
This is my first internship and I was given an assignment that Im unsure of how to start. So my company buys a bunch of raw data that is stored in an excel sheet and they want to be able to "click a button" and its automated to create another excel sheet that only takes certain columns (ones they told me they want) from the raw data and does calculations, etc. How would you do this? I was thinking of doing a sort of database that only takes in the data they want as well as does the calculations and they would need to run a noscript which would create a new excel sheet and interact with the raw data so the queries of the database can run...Im unsure if I explained it well, but anything helps! Thank you
https://redd.it/1d818nd
@r_bash
Hi All,
This is my first internship and I was given an assignment that Im unsure of how to start. So my company buys a bunch of raw data that is stored in an excel sheet and they want to be able to "click a button" and its automated to create another excel sheet that only takes certain columns (ones they told me they want) from the raw data and does calculations, etc. How would you do this? I was thinking of doing a sort of database that only takes in the data they want as well as does the calculations and they would need to run a noscript which would create a new excel sheet and interact with the raw data so the queries of the database can run...Im unsure if I explained it well, but anything helps! Thank you
https://redd.it/1d818nd
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community