TIL: Prompt in "read -p prompt" goes to stderr
It is documented in
>\-p prompt
>
>Display prompt on standard error, without a trailing newline, before attempting to read any input. The prompt is displayed only if input is coming from a terminal.
but not in
>\-p prompt
>
>output the string PROMPT without a trailing newline before attempting to read
So,
https://redd.it/1cxkocc
@r_bash
It is documented in
man bash:>\-p prompt
>
>Display prompt on standard error, without a trailing newline, before attempting to read any input. The prompt is displayed only if input is coming from a terminal.
but not in
help read:>\-p prompt
>
>output the string PROMPT without a trailing newline before attempting to read
So,
echo -n prompt; read is NOT equivalent to read -p prompt. The former should be preferred, because you're free to send the prompt to either stdout or stderr without side effects. Even though read -p prompt 2>&1 would send the prompt to stdout, error messages produced by read would go there as well.https://redd.it/1cxkocc
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Ffmpeg, ranger & concatenating
I've been using these noscripts with mpv for years which makes it simple to chop up, crop & encode video from from mpv. add in a file delete noscript and I can chop up, crop & encode video, and delete the original from mpv just using the keyboard, which is nice.
what they don't allow me to do is stitch video back together, like this.
I use ranger to launch mpv and would be nice if I can use that to concatenate.
I currently have this in my rc.conf:
it kinda works a bit but feels janky, I need to delete files and rename stuff, and have no idea what I am doing when it comes to noscripting stuff.
ideally I would select %s files as I do with the space bar on ranger, be able to specify the output file name and not have to worry about duplicate mylist.txt files.
any ideas?
is this the right place for this kinda question? I'm new here
https://redd.it/1cxmx7y
@r_bash
I've been using these noscripts with mpv for years which makes it simple to chop up, crop & encode video from from mpv. add in a file delete noscript and I can chop up, crop & encode video, and delete the original from mpv just using the keyboard, which is nice.
what they don't allow me to do is stitch video back together, like this.
I use ranger to launch mpv and would be nice if I can use that to concatenate.
I currently have this in my rc.conf:
map xc shell for f in %s ; do echo "file $f'" >> mylist.txt; donemap xj shell ffmpeg -f concat -safe 0 -i mylist.txt -c copy complete.mp4it kinda works a bit but feels janky, I need to delete files and rename stuff, and have no idea what I am doing when it comes to noscripting stuff.
ideally I would select %s files as I do with the space bar on ranger, be able to specify the output file name and not have to worry about duplicate mylist.txt files.
any ideas?
is this the right place for this kinda question? I'm new here
https://redd.it/1cxmx7y
@r_bash
GitHub
GitHub - occivink/mpv-noscripts: Various noscripts for mpv
Various noscripts for mpv. Contribute to occivink/mpv-noscripts development by creating an account on GitHub.
ifempty: data protection wrapper for mkfs.X tools
When you try to format some non-empty storage with mkfs.ext4, it asks for a confirmation:
> truncate -s 100m 1.img
> mkfs.ext4 1.img
mke2fs 1.46.5 (30-Dec-2021)
Discarding device blocks: done
Creating filesystem with 25600 4k blocks and 25600 inodes
Allocating group tables: done
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done
> mkfs.ext4 1.img
mke2fs 1.46.5 (30-Dec-2021)
1.img contains a ext4 file system
created on Wed May 22 02:13:10 2024
Proceed anyway? (y,N) n
Not all mkfs tools act like that. For example, mkfs.fat (and aliases mkfs.msdos, mkfs.vfat), mkfs.exfat, mkfs.udf, mkfs.ntfs, mkfs.minix just format everything without any checks.
My noscript can be used to add the non-empty check to such "dumb" tools. There is a detailed README in the repo
https://github.com/slowpeek/ifempty
https://redd.it/1cxlwkf
@r_bash
When you try to format some non-empty storage with mkfs.ext4, it asks for a confirmation:
> truncate -s 100m 1.img
> mkfs.ext4 1.img
mke2fs 1.46.5 (30-Dec-2021)
Discarding device blocks: done
Creating filesystem with 25600 4k blocks and 25600 inodes
Allocating group tables: done
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done
> mkfs.ext4 1.img
mke2fs 1.46.5 (30-Dec-2021)
1.img contains a ext4 file system
created on Wed May 22 02:13:10 2024
Proceed anyway? (y,N) n
Not all mkfs tools act like that. For example, mkfs.fat (and aliases mkfs.msdos, mkfs.vfat), mkfs.exfat, mkfs.udf, mkfs.ntfs, mkfs.minix just format everything without any checks.
My noscript can be used to add the non-empty check to such "dumb" tools. There is a detailed README in the repo
https://github.com/slowpeek/ifempty
https://redd.it/1cxlwkf
@r_bash
GitHub
GitHub - slowpeek/ifempty: Data protection wrapper for mkfs.X tools
Data protection wrapper for mkfs.X tools. Contribute to slowpeek/ifempty development by creating an account on GitHub.
Whenever I run the 'find' command, it seems to replace Chinese characters with "?" marks. The 'ls' command does not do this. How do I get 'find' to behave?
Meanwhile,
What gives?
https://redd.it/1cxq2ci
@r_bash
user@server$ find . -type f...????????????????? www.HDBTHD.com???????????????[???????????????].Stargate.1994.1080p.BluRay.x265.10bit.DTS.mkv...Meanwhile,
ls correctly gives me: 【高清影视之家发布 www.HDBTHD.com】星际之门[简繁英字幕].Stargate.1994.1080p.BluRay.x265.10bit.DTS.mkv.What gives?
https://redd.it/1cxq2ci
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Starship Prompt showing vertical line in the prompt graphic.
I recently started using Starship to configure my bash prompt. One thing I noticed are these vertical lines that appear when the shape of the prompt graphic changes. I have a slight orange line where it changes to a point and a slight blue line when it changes to a half circle. Is there a way to fix this?
https://preview.redd.it/frbwxp0vd12d1.png?width=291&format=png&auto=webp&s=af37adcc3788d62ff210fc3a3de4f77e00b5e418
https://redd.it/1cya8tt
@r_bash
I recently started using Starship to configure my bash prompt. One thing I noticed are these vertical lines that appear when the shape of the prompt graphic changes. I have a slight orange line where it changes to a point and a slight blue line when it changes to a half circle. Is there a way to fix this?
https://preview.redd.it/frbwxp0vd12d1.png?width=291&format=png&auto=webp&s=af37adcc3788d62ff210fc3a3de4f77e00b5e418
https://redd.it/1cya8tt
@r_bash
is there a shortcut for jump to start of a command and other for jump to end of the same command?
Hi!. sometimes I wrote long command for 4 lines and repeat the command and I' d like to know if there is a shorcut for move the prompt to start of the command.
for example:
~/path/$ montage * -tile 3x2 -shadow -geometry 200x200+5+5 -noscript '\nEmisiones del día miércoles 22 Mayo 2024\nentre 01 y 04:30hs.\nE.E.G. cada 7 minutos y de 30 seg. de duración.\nModerado Humo y moderado Olor\nEn aumento con el paso de las horas' -pointsize 12 -set label '%f\n%wx%hpx\n%[exif:DateTime]hs' -quality 90 ../catalogo3.jpg
Thank you and Regards!
https://redd.it/1cye9mu
@r_bash
Hi!. sometimes I wrote long command for 4 lines and repeat the command and I' d like to know if there is a shorcut for move the prompt to start of the command.
for example:
~/path/$ montage * -tile 3x2 -shadow -geometry 200x200+5+5 -noscript '\nEmisiones del día miércoles 22 Mayo 2024\nentre 01 y 04:30hs.\nE.E.G. cada 7 minutos y de 30 seg. de duración.\nModerado Humo y moderado Olor\nEn aumento con el paso de las horas' -pointsize 12 -set label '%f\n%wx%hpx\n%[exif:DateTime]hs' -quality 90 ../catalogo3.jpg
Thank you and Regards!
https://redd.it/1cye9mu
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Could someone explain this behaviour?
> bash -c 'ls -l "$1"; sudo ls -l "$1"' - <(echo abc)
lr-x------ 1 pcowner pcowner 64 May 24 02:36 /dev/fd/63 -> 'pipe:679883'
ls: cannot access '/dev/fd/63': No such file or directory
https://redd.it/1cz734d
@r_bash
> bash -c 'ls -l "$1"; sudo ls -l "$1"' - <(echo abc)
lr-x------ 1 pcowner pcowner 64 May 24 02:36 /dev/fd/63 -> 'pipe:679883'
ls: cannot access '/dev/fd/63': No such file or directory
https://redd.it/1cz734d
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
is there a difference between "ctrl /" and "ctrl shift -" ?
hello, i'm trying to learn the keyboard shortcuts for bash, and i was learning about how to undo something i did in the terminal text line and i heard about
"ctrl /" which undoes something you did in your text line
then i heard about
"ctrl shift -" which ALSO undoes something you did in the text line apparently
is there any difference between the two keyboard shortcuts? or are they both the same?
thank you
https://redd.it/1czgu8h
@r_bash
hello, i'm trying to learn the keyboard shortcuts for bash, and i was learning about how to undo something i did in the terminal text line and i heard about
"ctrl /" which undoes something you did in your text line
then i heard about
"ctrl shift -" which ALSO undoes something you did in the text line apparently
is there any difference between the two keyboard shortcuts? or are they both the same?
thank you
https://redd.it/1czgu8h
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
BASH syntax help
Hi folks.
I am struggling with my BASH syntax. I am trying translate some commands from the cli, in to a noscript. I am capturing input variables, to be used within an array, however for the life of me I cannot figure out where I am messing up.
Here is the cmd, from the cli:-
`grep -E $"date"\|HTTP/[0-9]*\.[0-9]+\"\s$status' *`
Here is the noscript, in which I began using two greps, as doing it like the above, using `'pattern1\|pattern2'` didn't work, even on the cli:-
1 #!/bin/env bash
2
3
4
5 echo Please enter the day, month, year and time you wish to search \(eg:- 6 12/Nov/2023:13:24 or 12/Nov/2023:01:24\) [Enter]:
6 read date
7
8 echo Please enter the http status code you wish to search \(eg:- 200\) [Enter]:
9 read status
10
11 echo Please enter the server name you wish to search \(eg:- SERVER.DOMAIN\) [Enter]:
12 read server
13
14 search="$(grep -a '$date' log-file-2024* > /tmp/first.txt && grep -a 'HTTP/1.0" "$status" first.txt > /tmp/"$server"_access_logs.txt)"
15
16 ssh user@"$server" cd /SOME/RANDOM/DIR; timeout -k 2 20 "$search"
The error I receive when running `bash -x` [`noscript.sh`](http://noscript.sh):-
`noscript.sh: line 14: first.txt > /tmp/first.txt: No such file or directory`
... then my ssh command sits idle, without having any variables successfully added, like so:-
`+ ssh user@ cd /some/random/directory`
I have tried various approaches to my variables, but I can never get them to be called, correctly.
https://redd.it/1czm64i
@r_bash
Hi folks.
I am struggling with my BASH syntax. I am trying translate some commands from the cli, in to a noscript. I am capturing input variables, to be used within an array, however for the life of me I cannot figure out where I am messing up.
Here is the cmd, from the cli:-
`grep -E $"date"\|HTTP/[0-9]*\.[0-9]+\"\s$status' *`
Here is the noscript, in which I began using two greps, as doing it like the above, using `'pattern1\|pattern2'` didn't work, even on the cli:-
1 #!/bin/env bash
2
3
4
5 echo Please enter the day, month, year and time you wish to search \(eg:- 6 12/Nov/2023:13:24 or 12/Nov/2023:01:24\) [Enter]:
6 read date
7
8 echo Please enter the http status code you wish to search \(eg:- 200\) [Enter]:
9 read status
10
11 echo Please enter the server name you wish to search \(eg:- SERVER.DOMAIN\) [Enter]:
12 read server
13
14 search="$(grep -a '$date' log-file-2024* > /tmp/first.txt && grep -a 'HTTP/1.0" "$status" first.txt > /tmp/"$server"_access_logs.txt)"
15
16 ssh user@"$server" cd /SOME/RANDOM/DIR; timeout -k 2 20 "$search"
The error I receive when running `bash -x` [`noscript.sh`](http://noscript.sh):-
`noscript.sh: line 14: first.txt > /tmp/first.txt: No such file or directory`
... then my ssh command sits idle, without having any variables successfully added, like so:-
`+ ssh user@ cd /some/random/directory`
I have tried various approaches to my variables, but I can never get them to be called, correctly.
https://redd.it/1czm64i
@r_bash
how to bash noscript output to vim
So I created a custom bash noscript echos some question to read input from user for configuration purpose and later echo $(pwd)/filename.sh. When the noscript outputs the path + filename, I would like to open vim with the output. I tried pipe the output to vim input, but somehow the bash noscript doesn't appear to echoing anything to read input. Anyone wanna give me some idea how and why? For now, my assumption is that when noscript is executed where both echo and read is operated, echo is redirected to vim (which why any echo from noscript doesn't show output on terminal) and read waits for my input. If I can redirect the echo back to the terminal, then the expression works as expected. But I do not know how. Maybe I need to use either `>` or `>>` to redirect `echo` output to shell?
`$ noscript-gen.sh | xargs vim # failed`
https://redd.it/1czta63
@r_bash
So I created a custom bash noscript echos some question to read input from user for configuration purpose and later echo $(pwd)/filename.sh. When the noscript outputs the path + filename, I would like to open vim with the output. I tried pipe the output to vim input, but somehow the bash noscript doesn't appear to echoing anything to read input. Anyone wanna give me some idea how and why? For now, my assumption is that when noscript is executed where both echo and read is operated, echo is redirected to vim (which why any echo from noscript doesn't show output on terminal) and read waits for my input. If I can redirect the echo back to the terminal, then the expression works as expected. But I do not know how. Maybe I need to use either `>` or `>>` to redirect `echo` output to shell?
`$ noscript-gen.sh | xargs vim # failed`
https://redd.it/1czta63
@r_bash
Image Conversion Bash Script
# Image Conversion Script
## Overview
This noscript provides a comprehensive solution for converting image files between various formats using ImageMagick and FFmpeg. It supports a wide range of input and output formats, including PNG, JPG, WEBP, JFIF, ICO, TIFF, BMP, and GIF. The noscript is designed to be efficient, easy to use, and versatile, catering to the needs of users who require reliable image format conversion.
## Target Audience
This noscript is intended for:
- Developers and IT professionals who need to batch convert image files as part of their workflow.
- Graphic designers and content creators who frequently work with different image formats.
- System administrators looking for a robust solution to automate image conversion tasks.
- Any user who requires a straightforward, command-line based method to convert image files.
## Features
- Multiple Input and Output Formats: Supports PNG, JPG, WEBP, JFIF, ICO, TIFF, BMP, and GIF formats for both input and output.
- Batch Processing: Converts multiple files in a directory, saving time and effort.
- Output Directory: Stores all converted files in an
- Dependency Check: Verifies the presence of necessary dependencies (ImageMagick and FFmpeg) before execution.
- Interactive Deletion: Offers an option to delete the original files after conversion.
## Usage
To use the noscript, follow these steps:
1. Ensure Dependencies: Make sure ImageMagick and FFmpeg are installed on your system.
2. Run the Script: Execute the noscript in the directory containing your image files.
3. Select Output Formats: When prompted, enter the desired output formats (comma-separated, e.g., jpg,png,ico).
4. Conversion: The noscript will convert the files and store the output in the
5. Optional Deletion: Choose whether to delete the original files after conversion.
## Why This Script?
This noscript stands out due to its:
- Versatility: Unlike many other noscripts that support limited formats, this noscript accommodates a broad range of image file types, making it a one-stop solution for various conversion needs.
- User-Friendly Design: With clear prompts and organized output, the noscript ensures a smooth user experience.
- Batch Processing Capability: It efficiently handles multiple files, streamlining the conversion process and enhancing productivity.
- Professional and Robust Approach: The noscript includes thorough checks and error handling, ensuring reliability and robustness in diverse environments.
## Conclusion
This image conversion noscript is a powerful tool designed for users who need a reliable and versatile solution for converting image files between various formats. Its wide range of supported formats, ease of use, and efficient batch processing make it an essential utility for developers, designers, and system administrators alike.
## Download the noscript
You can download the noscript here on my GitHub page.
https://redd.it/1d08ada
@r_bash
# Image Conversion Script
## Overview
This noscript provides a comprehensive solution for converting image files between various formats using ImageMagick and FFmpeg. It supports a wide range of input and output formats, including PNG, JPG, WEBP, JFIF, ICO, TIFF, BMP, and GIF. The noscript is designed to be efficient, easy to use, and versatile, catering to the needs of users who require reliable image format conversion.
## Target Audience
This noscript is intended for:
- Developers and IT professionals who need to batch convert image files as part of their workflow.
- Graphic designers and content creators who frequently work with different image formats.
- System administrators looking for a robust solution to automate image conversion tasks.
- Any user who requires a straightforward, command-line based method to convert image files.
## Features
- Multiple Input and Output Formats: Supports PNG, JPG, WEBP, JFIF, ICO, TIFF, BMP, and GIF formats for both input and output.
- Batch Processing: Converts multiple files in a directory, saving time and effort.
- Output Directory: Stores all converted files in an
output directory within the noscript's directory, ensuring a clean and organized workspace.- Dependency Check: Verifies the presence of necessary dependencies (ImageMagick and FFmpeg) before execution.
- Interactive Deletion: Offers an option to delete the original files after conversion.
## Usage
To use the noscript, follow these steps:
1. Ensure Dependencies: Make sure ImageMagick and FFmpeg are installed on your system.
2. Run the Script: Execute the noscript in the directory containing your image files.
3. Select Output Formats: When prompted, enter the desired output formats (comma-separated, e.g., jpg,png,ico).
4. Conversion: The noscript will convert the files and store the output in the
output directory.5. Optional Deletion: Choose whether to delete the original files after conversion.
## Why This Script?
This noscript stands out due to its:
- Versatility: Unlike many other noscripts that support limited formats, this noscript accommodates a broad range of image file types, making it a one-stop solution for various conversion needs.
- User-Friendly Design: With clear prompts and organized output, the noscript ensures a smooth user experience.
- Batch Processing Capability: It efficiently handles multiple files, streamlining the conversion process and enhancing productivity.
- Professional and Robust Approach: The noscript includes thorough checks and error handling, ensuring reliability and robustness in diverse environments.
## Conclusion
This image conversion noscript is a powerful tool designed for users who need a reliable and versatile solution for converting image files between various formats. Its wide range of supported formats, ease of use, and efficient batch processing make it an essential utility for developers, designers, and system administrators alike.
## Download the noscript
You can download the noscript here on my GitHub page.
https://redd.it/1d08ada
@r_bash
GitHub
noscript-repo/Bash/Installer Scripts/ImageMagick/noscripts/master-converter.sh at main · slyfox1186/noscript-repo
My personal noscript repository with multiple languages supported. AHK v1+v2 | BASH | BATCH | JSON | POWERSHELL | POWERSHELL | PYTHON | WINDOWS REGISTRY | XML - slyfox1186/noscript-repo
GOTCHA: The arithmetic form that can kill your noscript
Q: Why use
On the surface, they both do the same thing (decrement
However, there's an additional wrinkle to the arithmetic command form that can interact unexpectedly with
>
>The
Which is why this noscript:
#!/usr/bin/env bash
errexit() {
printf "ERROR: %s:%s\n" "${BASHSOURCE1}" "${BASHLINENO[0]}"
exit 1
}
trap errexit ERR
set -e
a=1
a=$((a-1))
echo "a=$a"
a=1
((--a))
echo "a=$a"
outputs this:
a=0
ERROR: test-arith.sh:14
and why your
If you insist on using
...
set +e
((...)) # avoid abend on 0
set -e
...
The assignment form is more typing in general, but fewer WTFs (unless you typo'd the assigned name).
https://redd.it/1d09n3b
@r_bash
Q: Why use
a=$((a-1)) when you can say ((--a))?On the surface, they both do the same thing (decrement
a), but the latter saves quite a few characters with long variable names, and saves you from a frustrating debugging session if you typo the name on the LHS of the assignment.However, there's an additional wrinkle to the arithmetic command form that can interact unexpectedly with
set -e, that the assignment form never triggers. It crops up when a=1, and is documented in *The Fine (bash) Manual*:>
((expression))>The
expression is evaluated according to the rules described below under ARITHMETIC EVALUATION. If the value of the expression is non-zero, the return status is 0; otherwise the return status is 1.Which is why this noscript:
#!/usr/bin/env bash
errexit() {
printf "ERROR: %s:%s\n" "${BASHSOURCE1}" "${BASHLINENO[0]}"
exit 1
}
trap errexit ERR
set -e
a=1
a=$((a-1))
echo "a=$a"
a=1
((--a))
echo "a=$a"
outputs this:
a=0
ERROR: test-arith.sh:14
and why your
set -e noscript may be failing almost at random, when evaluating seemingly-innocent math.If you insist on using
set -e across all your noscripts, you really want to NOT use the ((...)) form except where the return status is ignored (see the set -e documentation for details on that), or if you're absolutely sure that the expression in the form never evaluates to 0, or if you're willing to do something like this:...
set +e
((...)) # avoid abend on 0
set -e
...
The assignment form is more typing in general, but fewer WTFs (unless you typo'd the assigned name).
https://redd.it/1d09n3b
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
bracketed-paste doesnt work sometimes. Anyone has this problem?
I have
> bind -v | grep paste
set enable-bracketed-paste on
but it does not always work! Sometimes when I paste a command with a trailing newline into my terminal, it runs right away. But if I paste it once more right away, it does not run, just like it should with bracketed-paste enabled.
Any idea would could be wrong? It is bash 5.1.16 in ubuntu 22.04. The terminal is konsole.
---
I recall using the feature since ubuntu 18.04 (enabled with
https://redd.it/1d0da66
@r_bash
I have
bracketed-paste enabled:> bind -v | grep paste
set enable-bracketed-paste on
but it does not always work! Sometimes when I paste a command with a trailing newline into my terminal, it runs right away. But if I paste it once more right away, it does not run, just like it should with bracketed-paste enabled.
Any idea would could be wrong? It is bash 5.1.16 in ubuntu 22.04. The terminal is konsole.
---
I recall using the feature since ubuntu 18.04 (enabled with
.inputrc). It never failed for me in ubuntu 18.04 (bash 4.4) and 20.04 (bash 5.0).https://redd.it/1d0da66
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Clean up FF bookmarks file.
I don't know if any you have ever seen the disgraceful steaming pile of shit garbage html that firefox shits out when you ask it to export your bookmarks, but it is truly a right and goodly fucked up mess.
Have any of ya'll ever heard of or seen a noscript or something to clean that garbage file up into something resembling sensible?
Example...
> <DT><A HREF="https://moviesjoy.to/" ADD_DATE="1681307349" LAST_MODIFIED="1681307349" ICON_URI="fake-favicon-uri:https://moviesjoy.to/"
I don't know if any you have ever seen the disgraceful steaming pile of shit garbage html that firefox shits out when you ask it to export your bookmarks, but it is truly a right and goodly fucked up mess.
Have any of ya'll ever heard of or seen a noscript or something to clean that garbage file up into something resembling sensible?
Example...
> <DT><A HREF="https://moviesjoy.to/" ADD_DATE="1681307349" LAST_MODIFIED="1681307349" ICON_URI="fake-favicon-uri:https://moviesjoy.to/"
ICON=
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA25pVFh0WE1MOmNvbS5hZG9iZS54b
XAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2Jl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ARRjgQ7+QWaSoD2WZxr6+izKlyxAaplMu12FkkTN2iW1MCu7PDuAT+VBmepnZKXxaut+Fp/WXctN+WGoQpUUAAKXRUzOANBs34nQr//Bx7WDij5yNng0mWzcShnk7qOYEIcHSikABxxZgR1G5ecgaBd2BAd94kdAELbMjxQXXMBK1a9hfeXTEfJuTzn9+pZPExH2mlWD1C5EJ4kwLk6iHCAYCgJMN8ZxqqDRbBoFnMPY+E/X8SaL+ajobHOUB0EvXXZSXuyYfCBQVPTFZ0k6JgX1ZEZDCRBZKTGFUkQTSTjSm0l94V9t3cN5sybiL0HvuTe16mTqpRGec6xyCx8yhvwzNldDsOhZZJnIKFe49NJgqRXHSNJ0I7l2GxRjYoLpw1tFl3KW7V6Lv7+/lSUnM1V3Zt3UrVSRXkWlX2C1BDOQNv+OYePqL+AmOgBCA6KUVVxweTZ9l+JWcVlYndBG53xskYnoSx7fu2X7+DCT8VOXV91TQUOHFpv251CVbmwMBsrV/+VZIS2zeI09qHb5GrZ3eL0M5Np2oF8fDrj8UcWI6prsmoXt9Evu6GRVwK3L3HDUQq3HZosjytl8d37PsHXWxd1xHIAXWCcqqwLKJ1dZEngBkVDBz0H652jEBbSXS0JRqAwx+Bsgdet/YO/pkC/RyivOIXsI+tQULinI5inCwNJ8q/uewG61XMlbu9Gv3j7zGhhhH5js/Q2Zv4DlnmjlaFZhNbfhsxTnmbqYh3OhdRCPkloy23E/CaZpxZXAKCNfk2RdZuoA+VhnMwTXAWAtmto+8CIIld5CzJO5zxJ5uGaYbjvwkDUMCbLvrPlFmC8RZ5rsisezeIGmjRwoPvT30Xbl9s3WyuT52aV5+qS1Aoefj5PvzWg2+3p5/M0QgqkweMNZpSKc72czBTJ6fwOtPPz+f8LMAAA+DuW/W2pegAAAABJRU5ErkJggg==">MoviesJoy - Free movies streaming, watch movies online</A>
What in the actual fuck.
https://redd.it/1d0oc21
@r_bash
What in the actual fuck.
https://redd.it/1d0oc21
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Need help to understand this tbh
hello, let me tell you:
I was doing a noscript in bash and the situation has arisen where a function prints both informational messages and values that I will later want to store inside variables when I call the function in other functions or anywhere else in the noscript, something like this would be to represent the idea:
#!/usr/bin/env bash
foo(){
local a=${1} b=${2}
local sum=$(( a + b ))
printf "\n+ Checking something...\n"
printf "%s\n" $sum
}
bar(){
local value="$(foo 2 3)"
printf "%s\n" $value
}
bar
More or less this would be the idea but applied to the function I am performing, then I do not know where I read, that what used to be done was to redirect the informative messages to fd 2 and the values that will be used later to fd 1, so that then when calling the function to capture the values, on the one hand the informative messages are printed on the screen and also the value or values are stored in the declared variable (and only the value, not the informative messages).
Basically what I want is to store in a variable the value returned by the function and at the same time print the informative messages on the screen, without storing this ones inside the previous variable.
The thing is that I asked the AI what I could do and it told me this:
exec 3>&1
value=$( foo "${2}" "${3}" 2>&1 >&3 3>&1 )
exec 3>&-
And the truth is that after asking him several questions about this code, tbh I have not understood anything and it is very difficult for me to understand what is the purpose of all this sequence of commands.
I understand that
And then in the next line I get even more lost, because I know that
Thank you in advance to the one(s) who will help me to solve my doubt 😊
https://redd.it/1d18wo7
@r_bash
hello, let me tell you:
I was doing a noscript in bash and the situation has arisen where a function prints both informational messages and values that I will later want to store inside variables when I call the function in other functions or anywhere else in the noscript, something like this would be to represent the idea:
#!/usr/bin/env bash
foo(){
local a=${1} b=${2}
local sum=$(( a + b ))
printf "\n+ Checking something...\n"
printf "%s\n" $sum
}
bar(){
local value="$(foo 2 3)"
printf "%s\n" $value
}
bar
More or less this would be the idea but applied to the function I am performing, then I do not know where I read, that what used to be done was to redirect the informative messages to fd 2 and the values that will be used later to fd 1, so that then when calling the function to capture the values, on the one hand the informative messages are printed on the screen and also the value or values are stored in the declared variable (and only the value, not the informative messages).
Basically what I want is to store in a variable the value returned by the function and at the same time print the informative messages on the screen, without storing this ones inside the previous variable.
The thing is that I asked the AI what I could do and it told me this:
exec 3>&1
value=$( foo "${2}" "${3}" 2>&1 >&3 3>&1 )
exec 3>&-
And the truth is that after asking him several questions about this code, tbh I have not understood anything and it is very difficult for me to understand what is the purpose of all this sequence of commands.
I understand that
exec 3>&1 what it does is to make a duplicate of fd 1 in fd 3 to keep the original state of fd 1, but I don't understand why.And then in the next line I get even more lost, because I know that
2>&1 redirects stderr to stdout, but I do not understand why then redirects >&3 fd 1 (which contains fd 1 and fd 2) to fd 3 and then do 3>&1, the truth is that I do not understand anything and I would like to get to understand it.Thank you in advance to the one(s) who will help me to solve my doubt 😊
https://redd.it/1d18wo7
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Bash Script for Building Various GNU Programs from Source
Hey guys,
I have a GitHub repo that is mostly centered around productivity related tasks so I decided that I would create a build noscript to install what I consider to be the more mainstream GNU packages that are used more often than some of the others.
# Denoscription
This noscript will prompt you to choose which programs to install (you can choose
The noscript also will create soft links to the folder located in
# Optimizations
The noscript uses the following CFLAGS/CXXFLAGS settings:
-O3: Is a compiler optimization level flag that tells the compiler to perform aggressive optimizations when compiling the code.
-pipe: Is used to tell the compiler to use pipes rather than temporary files for communication between the different stages of compilation. When you compile a program, there are several stages involved, such as preprocessing, compiling, assembling, and linking. Normally, intermediate files are created and stored on disk during each stage, but using pipes instead of files can potentially improve the compilation speed, especially on systems with slow disk I/O.
-flto: Stands for "Link Time Optimization." It instructs the compiler to perform optimizations across different source files during the linking phase of compilation.
-march=native: Tells the compiler to generate code optimized for the CPU architecture on which the compilation is being performed.
# Removal
Each package that you choose to install will be located at the path
cd /usr/local/
sudo rm -fr PROGRAM-NAME-VERSION
# Important info for people new to this type of thing or Linux in general
When you install the latest version of ANY package there is a potential for incompatibility which another way to say this is that you can get errors when doing daily tasks. These can be as severe as what you would call "system breaking" so make sure that you understand this before using the noscript. I personally have installed all packages on both Debian 12 and Ubuntu 22.04 and SO FAR have not seen any issues but that is the extent of my knowledge. So please do your own homework and for anyone that does try this I wish that this is something you find useful.
You can download the noscript here on GitHub.
Here's to hoping this makes someone's life better in some way.
Cheers - J
https://redd.it/1d1dxog
@r_bash
Hey guys,
I have a GitHub repo that is mostly centered around productivity related tasks so I decided that I would create a build noscript to install what I consider to be the more mainstream GNU packages that are used more often than some of the others.
# Denoscription
This noscript will prompt you to choose which programs to install (you can choose
all) and then it will download, build, and compile each program from the latest source code (except for autoconf, which is set to version 2.71 due to errors I have gotten from the latest version 2.72) .The noscript also will create soft links to the folder located in
/usr/local for any files found in the programs install directory in the folders bin, include, and lib/pkgconfig# Optimizations
The noscript uses the following CFLAGS/CXXFLAGS settings:
-O3 -pipe -flto -march=native-O3: Is a compiler optimization level flag that tells the compiler to perform aggressive optimizations when compiling the code.
-pipe: Is used to tell the compiler to use pipes rather than temporary files for communication between the different stages of compilation. When you compile a program, there are several stages involved, such as preprocessing, compiling, assembling, and linking. Normally, intermediate files are created and stored on disk during each stage, but using pipes instead of files can potentially improve the compilation speed, especially on systems with slow disk I/O.
-flto: Stands for "Link Time Optimization." It instructs the compiler to perform optimizations across different source files during the linking phase of compilation.
-march=native: Tells the compiler to generate code optimized for the CPU architecture on which the compilation is being performed.
# Removal
Each package that you choose to install will be located at the path
/usr/local/PROGRAM-NAME-VERSION so if you ever want to quickly remove a package you can run the below commands and it should fix any issues immediately IF you do experience errors or other issues.cd /usr/local/
sudo rm -fr PROGRAM-NAME-VERSION
# Important info for people new to this type of thing or Linux in general
When you install the latest version of ANY package there is a potential for incompatibility which another way to say this is that you can get errors when doing daily tasks. These can be as severe as what you would call "system breaking" so make sure that you understand this before using the noscript. I personally have installed all packages on both Debian 12 and Ubuntu 22.04 and SO FAR have not seen any issues but that is the extent of my knowledge. So please do your own homework and for anyone that does try this I wish that this is something you find useful.
You can download the noscript here on GitHub.
Here's to hoping this makes someone's life better in some way.
Cheers - J
https://redd.it/1d1dxog
@r_bash
GitHub
noscript-repo/Bash/Installer Scripts/GNU Software/build-all-gnu.sh at main · slyfox1186/noscript-repo
My personal noscript repository with multiple languages supported. AHK v1+v2 | BASH | BATCH | JSON | POWERSHELL | POWERSHELL | PYTHON | WINDOWS REGISTRY | XML - slyfox1186/noscript-repo
bash noscript stops at evaluating modulo
A bash noscript with "set -e" stops unexpectedly. To debug, I use
bash -x foobar
the last thing displayed is:
​
\++ wc -l
\+ NDISKNODES=1
\+ export NDISKNODES
\++ expr 69677 % 1
\+ NODEINDEX=0
​
The corresponding part of the noscript is:
NDISKNODES=`cat $DISKNODELIST | wc -l`
export NDISKNODES
NODEINDEX=`expr $PID % $NDISKNODES`
​
So it doesn't seem to like the expr calculating a modulo?
$PID is the process ID, which is 69677 in example.
Same thing happens in Centos or Debian.
https://redd.it/1d1jjeu
@r_bash
A bash noscript with "set -e" stops unexpectedly. To debug, I use
bash -x foobar
the last thing displayed is:
​
\++ wc -l
\+ NDISKNODES=1
\+ export NDISKNODES
\++ expr 69677 % 1
\+ NODEINDEX=0
​
The corresponding part of the noscript is:
NDISKNODES=`cat $DISKNODELIST | wc -l`
export NDISKNODES
NODEINDEX=`expr $PID % $NDISKNODES`
​
So it doesn't seem to like the expr calculating a modulo?
$PID is the process ID, which is 69677 in example.
Same thing happens in Centos or Debian.
https://redd.it/1d1jjeu
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
What is a clever way to run your cronjobs?
I've created a node.js noscript that scrapes websites. I want them to give me a notification every 7 days. Mail or anything. What's the clever way to run this cronjob?
I don't have a mail smtp server..I am unable to think of a clever approach of notifying myself about the result of the noscript.
https://redd.it/1d1tz8u
@r_bash
I've created a node.js noscript that scrapes websites. I want them to give me a notification every 7 days. Mail or anything. What's the clever way to run this cronjob?
I don't have a mail smtp server..I am unable to think of a clever approach of notifying myself about the result of the noscript.
https://redd.it/1d1tz8u
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community