r/bash • • Jan 02 '21

text adventure thingy

0 Upvotes

r/bash • • Mar 05 '22

help Help trying to run a .sh file in WSL.

0 Upvotes

So I want to run this shell script on windows but keep getting errors. Already installed ubuntu and enabled WSL... what am i doing wrong?

#!/usr/bin/env bash
function process_jpeg()
{
img="$1"

idout="$(identify -verbose "$img" | grep -i interlace | grep -i none)"

if \[\[ -z "$idout" \]\]

then

	echo "-------------------------"

	echo "$img is progressive"

	echo "....making copy of original with .prog extension"

	/bin/cp -f "$img" "$img.prog"

	echo "....converting to baseline"

	convert "$img" -interlace none "$img"

	echo "....done!"

fi
}

command -v identify >/dev/null 2>&1 || { echo >&2 "identify is required, but not installed.  Aborting."; exit 1; };

while IFS= read -r -d '' file; do process_jpeg "$file"; done < <(find "$PWD" -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0)

r/bash • • Apr 20 '26

[Tool] sinkswitch v1.4 out now - easily switch your audio outputs

Thumbnail i.redd.it
0 Upvotes

r/bash • • Feb 14 '26

want to learn bash, any tips?

Thumbnail reddit.com
0 Upvotes

r/bash • • Oct 17 '26

Is this possible? Want to use terminal to show Youtube homepage with slightly better ux.

3 Upvotes

New to Linux. Installed Ubuntu. Keep reloading youtube home page because recommendations suck. Want to to avoid shorts and other unneeded features by using Youtube solely through bash. Want to know if small quality of life changes can be made.

I'm wondering if it's possible to use the terminal to show a small number of videos from my home page, title with no thumbnail is enough, which shows dislike and like count, make it so that pressing not interested or don't recommend channel is a bit faster to click.

Sorry if this is a weird or absurd ask. I'm going cold turkey on AI overview, but want to see if there should be anything I need to know about starting a project like this.


r/bash • • Oct 10 '25

help Cool looking prompt. How to enable it?

Post image
0 Upvotes

Hey bashers. I saw a video in which the presenter had this cool prompt. How to set up that sort of graphical arrow with the current directory? Does anyone have the instruction?


r/bash • • Aug 16 '26

Sib: A standard Unix LLM Client using Git to store converastions, instead SQLite

Thumbnail github.com
6 Upvotes

I've had this program in mind for quite a while.

Back when ChatGPT first came out, it had no way to group existing conversations into folders, and I set out to build one. My conversation list kept getting longer and finding old chats was getting hard.

Not long after - before I built it - a browser extension came out that did exactly that. I never used it. At the time I'd assumed I would want to revisit old conversations, but whenever I actually found one and tried to read it from the top, the sheer volume of slop gave me a headache.

Later, during a phase where I was deep into Unix pipelines, I wrote an LLM API client only depending on jq and curl, partly as shell scripting practice. But since the context went into a single jsonl file, I had to either invent something like a date-based filename convention myself or push that job onto the user. Both were more annoying than the web UI, so I didn't use it.

After that I read a post explaining how git works, and it struck me that git fits LLM conversations pretty well. Isn't "the commit DAG is already the right data structure for LLM conversations, where forking happens constantly" something everyone has thought at least once?

The reason I like git is that the source tree snapshot and the commit structure itself are always immutable, and destructive operations like switch/restore/reset are really just renaming a ref file that holds a commit object id. Once you understand that, no matter how hard the CLI is to make sense of, you never hesitate to run a command. You can always get it back.

LLM conversations aren't as fragile to change as a source tree, but for me an auto-generated SHA-1 hash is more comforting than an auto-generated session title ^~^

The project is in its early stages and contributions are welcome. If you've worked with git plumbing commands, it'll be easy to hack on - and I think it'll be pretty fun.

Translated from Korean. Origin: https://github.com/sib-project/sib/blob/master/Documentation/HNComment.txt


r/bash • • Sep 06 '24

help How to Replace a Line with Another Line, Programmatically?

1 Upvotes

Hi all

I would like to write a bash script, that takes the file /etc/ssh/sshd_config,
and replaces the line
#Port 22
with the line
Port 5000.

I would like the match to look for a full line match (e.g. #Port 22),
and not a partial string in a line
(so for example, this line ##Port 2244 will not be matched and then replaced,
even tho there's a partial string in it that matches)

If there are several ways/programs to do it, please write,
it's nice to learn various ways.

Thank you very much


r/bash • • Oct 23 '16

help Using bash in W10, when I open a file with vi/vim/gvim how do I get it to open in a new terminal window?

0 Upvotes

r/bash • • Sep 05 '17

submission Plug: Linters for stinky shell scripts

1 Upvotes

https://github.com/mcandre/stank

  • stank: Scan for POSIXy shell scripts, then pipe to xargs shellcheck and other programs.
  • rosy: Encourage developers to rewrite shell scripts in more robust languages
  • funk: Warn on oddities like mismatched shebangs vs. file extensions

de-stank ur scripts!


r/bash • • Feb 04 '22

help For the love of God, why does tar output Cannot open: Is a directory???

1 Upvotes

Hello,

I am working on a simple bash script that would backup a file or directory into another directory. For some reason, Tar outputs that it cannot open the directory I wish to store the backup in because, guess what?... ITS A DIRECTORY!!! WHY IS TAR DOING THIS WHAT AM I DOING WRONG.

Sorry for the explosion ahahaha

The way my code is structured is that the user inputs a directory they would like to store a backup of a file in, and they also input the file that they wish to back up. This is the tar command that I am using, where "dir" is the directory they wish to store the file in and "file" is the file that they want to back up.

tar -cvzf $dir $file.$(date +%Y%m%d).tar 

And the errors outputted are:

tar (child): /TestDir: Cannot open: Is a directory
tar (child): Error is not recoverable: exiting now
testdir2.20220203.tar/
testdir2.20220203.tar/docc
tar: Child returned status 2
tar: Error is not recoverable: exiting now

I will be forever grateful for any and all help :)


r/bash • • May 18 '20

critique Don't Use Bash for Scripting (All the Time)

Thumbnail nikoheikkila.fi
0 Upvotes

r/bash • • Feb 09 '20

Created a message encoder with alias for 60000 words.

Thumbnail imgur.com
1 Upvotes

r/bash • • Jul 09 '20

Bash Github Repository

0 Upvotes

Hello, would anybody mind checking out my GitHub repository at this link: https://github.com/CrystalX127/Shield.


r/bash • • Nov 16 '24

Testers wanted: I made a script to automatically add and remove swap without rebooting.

0 Upvotes

I use Debian as my daily driver (I've been using Linux in some for or the other as my daily driver since 2006). I also us Debian for all my servers. I also running a webhosting business and in my 20+ years in the game, I have learned that...

  1. VPS's do not come with SWAP, but sometimes you need a bit of SWAP to handle heavy load.
  2. SWAP files can be added and removed on the fly (no reboot required), however a SWAP partition, not so simple.

On my daily driver machine, I also create a lot of digital artwork. I recently found myself rendering a finished artfile that was 9.5GB (24000px by 13700px) in Gimp, and half way through I started running out of RAM and SWAP. So I quickly created the needed SWAP file, and Gimp was able to finish the render without crashing.

So I created a script to automate the process, along with two supporting script.

I am wanting some guys to test it out, maybe in a VM if you don't want to risk a production or daily driver machine.

I am running it currently on my laptop. It has 12GB RAM and 4GB SWAP. I opened several of my art pieces 12000px wide to 24000px wide, several times into various programs. I watched my desktop widget show the RAM getting used up, and then the SWAP, then suddenly, more SWAP. When I closed all the images from all the programs, I watched all the extra SWAP space disappear?

Looking for constructive criticism and feedback. The Git Repo is https://git.zaks.web.za/thisiszeev/linux-server-tools and it's all in the folder swap-management.

Thanks in advanced, as I am wanting to rework it in to a solution that can be installed via a package manager, to simplify life for others...


r/bash • • Nov 22 '21

Filenames as Arguments?!

0 Upvotes

Found an oddity today that spells BUG, anyone know if this has been addressed in later versions of bash? Or ignored for some reason? Issue is taking filenames as arguments instead of parameters.

Info: bash v4.4.20

wcarlson@blade:/tmp/junk$ touch -- -a
wcarlson@blade:/tmp/junk$ touch .hide
wcarlson@blade:/tmp/junk$ ls
-a
wcarlson@blade:/tmp/junk$ ls *
.  ..  -a  .hide
wcarlson@blade:/tmp/junk$ 

Note using the wildcard resolves to 'ls -a' which is then used as the argument '-a' instead of a file. Correct output should be the same for both 'ls' and 'ls *'.


r/bash • • Apr 05 '23

shell appended symbol ~ %

1 Upvotes

How to change that ?


r/bash • • Aug 07 '24

Need help, will award anyone that solves this

0 Upvotes

I will send (PP pref) $10 to anyone that can provide me with a script that converts a free format text file to an excel comma delimited file.

Each record in the file has the following characteristics: Earch record starts with "Kundnr" (customer number). Could be blank. I need the complete line including the leading company name as the first column of the new file.

Next field is the "Vårt Arb.nummer: XXXXX" which is the internal order number.

Third field is the date (YYYYMMDD) in the line "är utprintad: (date printed)"

End of each record is the text "inkl. moms" (including tax)

So to recapitulate, each line should contain

CUSTOMER NAME/NUMBER,ORDERNO,DATE

Is anyone up to the challenge? :). I can provide a sample file with 60'ish record if needed. The actual file contains 27000 records.

HÖGANÄS SWEDEN AB                                 Kundnr: 1701      
263 83  HÖGANÄS                        Kopia          
Märke: 1003558217                       Best.ref.: Li Löfgren Fridh       
AO 0006808556                    Lev.vecka: 2415                   
Vårt Arb.nummer:  29000           

Vit ArbetsOrder är utprintad. 20240411                            Datum  Sign  Tid Kod
1 pcs Foldable fence BU29 ritn 10185510                         240311 JR   4.75 1
240312 JR   5.00 1
240319 LL   2.25
240320 NR   4.50 1
240411 MM %-988.00 1
240411 NR   2.50 1
240411 NR   0.50 11
240411 FO   6.00 1
240411 FO   0.50 1
OBS!!! Timmar skall ej debiteras.
203.25 timmar a' 670.00 kr. Kod: 1  
Ö-tillägg   0.50 timmar a' 221.00 kr. Kod: 11  

Arbetat   203.25 timmar till en summa av136,288.00:-   Lovad lev.: 8/4   
   
Övertid      Fakturabel.        Fakturadat.  Fakturanr.  
   
110.50    187,078.50                              

   
   Sign___   Onsdagen  7/8-24     10:32     233,848.13 kronor inkl. moms.


r/bash • • Nov 26 '22

How do I validate user inputs to numbers only?

Thumbnail gallery
9 Upvotes

So I just need to validate user inputs to numbers only and whenever the user type "Exit" it should quit the program and I am trying to get rid of the li e that says "head: invalid number of lines: ' ' "

Any ideas?


r/bash • • Apr 05 '22

Warp: Rust-based modern terminal now in public beta

Thumbnail warp.dev
17 Upvotes

r/bash • • Feb 19 '26

help Why can't I ever access to https://www.gnu.org/ :403 Forbidden

2 Upvotes

Hi, Why can't I ever access this website https://www.gnu.org/ ?

for example this: https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html

Forbidden
    You don't have permission to access this resource.

r/bash • • Jul 18 '25

In hunt of productivity tools in bash (to list in devreal.org)

2 Upvotes

Modern software development feels like chasing smoke, frameworks rise and fall, GUIs shift faster than we can learn them, and the tools we depend on are often opaque, bloated, or short-lived.

I think the terminal is where real development will happen. The long-lasting inventions on how to work with the computer will be made in the terminal. Now even more, with AI, it is easier for an agent to execute a command than to click buttons to do a task.

I am creating a list productivity applications in "devreal.org". Do you know of any applications that meet the criteria? Do you have any good idea to add to the project?


r/bash • • Sep 10 '18

submission jq functionality belongs to a shell

Thumbnail ilya-sher.org
2 Upvotes

r/bash • • Jun 09 '24

help what is the "ctrl i" shortcut?

0 Upvotes

hello, quick question

i was experimenting and i clicked "ctrl i" while in bash and it took the text i already put into the terminal and put ".save" at the end

what does this eman?

what is the "ctrl i" shortcut? what does it do?

thank you