r_bash – Telegram
what is the difference between ctrl z and ctrl c?

quick question

what is the difference between ctrl z and ctrl c?

they seem to do the exact same thing as far as i can tell, is there a difference between the two?

thank you

https://redd.it/1d8lko2
@r_bash
When opening a new terminal instance with bash and running a noscript from there, how to enable user input?

Using dolphin's actions, I wanted to add a .desktop entry that:

launches a new instance of bash terminal
runs a utility console program (filetags)
which in turn expects user input to function properly
then exits

I can already achieve these steps manually - I can open a terminal myself, enter filetags some-file and then, through stdin, enter something, confirm and it works like a charm.

The problem lies in the fact that with this noscript I am opening a terminal instance automatically.

This is the part which executes the terminal:

Exec=cool-retro-term -e /bin/bash -ci "source $HOME/.bashprofile && source $HOME/.bashrc && $HOME/miniconda3/bin/conda run -n base filetags '%f'"

I thought I enabled user input with `stdin` by adding the `i` parameter to `bin/bash`, but I was disappointed to learn that the program exists immediately.

Even if I add `read` or `
$SHELL` or `/bin/bash` at the end of the noscript, it doesn't help. The execution has already moved past filetags. Whatever I enter later does not get piped into filetags.

For example, if I add /bin/bash at the end of the noscript:

Exec=cool-retro-term -e /bin/bash -ci "source
$HOME/.bashprofile && source $HOME/.bashrc && $HOME/miniconda3/bin/conda run -n base filetags '%f'; /bin/bash"

This is the result:

user@arch > filetags
some filetags output
waiting for input
user@arch >

As you can see, the only effect I'm getting is that my window stays open, but there's no way for me to input anything for the filetags.

https://redd.it/1d8nu0d
@r_bash
How to print dictionary with variable?

#!/bin/bash

# dictionary

declare -A ubuntu

ubuntu"name"="ubuntu"
ubuntu"cost"="0"
ubuntu"type"="os"
ubuntu"denoscription"="opens up ubuntu"

declare -A suse

suse"name"="suse"
suse"cost"="0"
suse"type"="os"
suse"denoscription"="opens up suse"

pop=suse

# prints suse denoscription
echo ${susedenoscription}



# how to make pop into a variable
echo ${$popdenoscription}
# output should be

opens up suse

https://redd.it/1d8sci2
@r_bash
Does regex101 work with sed, awk patterns?

I see that regex101 website is pretty common for testing regular expressions. For example to match remote `192.168.1.1` 1194 , I see a regex in python as remote \d+\.\d+\.\d+\.\d+ 1194 and is validated by the website. I have not seen d+ in linux tools regex though. I may be wrong. What would be a website to validate sed, awk patterns?

https://redd.it/1d9ky7n
@r_bash
Git bash compress a video

hi I have to compress a video I downloaded git bash but I don't know how to use it what should I do to compress the video with mpeg1video codec thanks in advance

https://redd.it/1da8ufb
@r_bash
I made a terminal based password manager

Hey everyone!

I’m excited to share Vaulty, a lightweight, terminal-based password manager I’ve been working on. It’s open-source, secure, and super easy to use right from your terminal.

https://preview.redd.it/o08870yq265d1.png?width=2048&format=png&auto=webp&s=b346c3b8116d18357ef05fdcfcacc5c8eb3b1c18

**Why Vaulty?**

* **Simple & Secure:** Uses AES-256 encryption and a master password for protection.
* **Local Storage:** Keeps your passwords on your machine.
* **Password Generation:** Create or generate strong passwords.
* **Idle Timeout:** Auto-exits after 2 minutes of inactivity.

**How It Works:**

1. **Setup:** Create a master password on first run.
2. **Add:** Save new passwords with a website name and username.
3. **Retrieve:** Look up saved passwords by website name.
4. **Update:** Change usernames or passwords.
5. **Delete:** Remove old entries.

**Tech Stack:**

* **Bash Script**
* **OpenSSL for AES-256 Encryption**
* **Clipboard Support** (requires `pbcopy` on macOS)

**GitHub:** [Vaulty on GitHub](https://github.com/arturfriedrich/Vaulty)

I’d love to hear your feedback and suggestions. Feel free to contribute!

Thanks for checking out Vaulty!

https://redd.it/1dadcii
@r_bash
Writing auto-update noscript for my VMs. Need advice

So recently, I've been trying to noscript more and get my github filled out for better job opportunities. I currently run a proxmox 8 hypervisor with several VMs. I've been working on a simple noscript to ssh in and run updates then reboot. My issue is that when I set up these VMs, I disabled the root account so that isn't an option right now. OS being used is Proxmox 8 and for the VMs it's Ubuntu server 22. I got my rsa key to login automatically on my VMs but I haven't been able to find a way to translate that into a password-less update command.

#!/bin/bash

#List of Servers
# 1:Network 2:Plex
srvlist=( "255.255.255.255" "255.255.255.255" )

#Admin login credentials
uname=<USERNAME>
pass=<PASSWORD>

#Update each server in order in srvlist
for server in ${srvlist@}; do
echo "Working on $server"
echo $pass | ssh -tt $uname@$server "sudo apt-get update && sudo unattended-upgrade && sudo reboot --now" 1> /dev/null
done

This is what I currently have written. It works, but I don't like that I have to keep login credentials in plain text. Sure, it'll be located in a read protected location only root has access to, but it still makes me feel weird to implement. My question is, how do I do this better?

https://redd.it/1dah0ux
@r_bash
sed -- change line only immediately after string match?

[foo]
value=horse

[bar]
value=horse

[baz]
value=hearse


Can I use sed (or another command-line tool?) to change only the second (the one in section [bar]) value?

https://redd.it/1dag5wm
@r_bash
need help with a grep noscript please

Hello everyone,

I am working on a weather project, and I have a .json file containing 5-day forecast information that I am trying to get specific information for 3 days from. I have 3 bash noscripts (bad noscripts) for tomorrow, the day after, and the day following. Each is meant to search the .json file and extract the weather icon code for that day. The .json file contains information in this format:

"dt_txt":"2024-06-08 06:00:00"},{"dt":1717837200,"main":{"temp":92.1,"feels_like":87.94,"temp_min":81.09,"temp_max":92.1,"pressure":1015,"sea_level":1015,"grnd_level":922,"humidity":16,"temp_kf":6.12},"weather":[{"id":800,"main":"Clear","denoscription":"clear sky","icon":"01n"}\]



there are 6 or 7 different entries for each date. All I want from the noscript is to read the first instance of any given date, and get the icon code from there. In the above case, "01n" is what I am looking for.

I cannot noscript and have spent many hours now with code generators that cannot successfully code this. What they produce keeps going deeper into the file and grabbing info from I don't know where.

Can anyone provide a working noscript that gets the information I am looking for?


Thank you for reading,

Logan

https://redd.it/1dautiw
@r_bash
New to this, a simple noscript for yt-dlp that asks for -F 1/2/3/4 choice before downloading?

How do I go from 'hello world' to

mynoscript url

where I can enter a number for a stream?

https://redd.it/1dc8qdi
@r_bash
What's a good project to step up my bash game?

Been on linux for a few years, the command line is not unfamiliar to me but I would still like to learn more. Any good projects to force me to learn?

https://redd.it/1dbd0lq
@r_bash
This media is not supported in your browser
VIEW IN TELEGRAM
I wrote a stupid simple progress bar in pure BASH (source in comments)
https://redd.it/1dc1j8w
@r_bash
what is the "ctrl i" shortcut?

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

https://redd.it/1dbpe7h
@r_bash
Bash history across different terminal sessions.

I use tillix for having multiple terminal windows open. After using different commands in different terminal windows, I checked bash history and it shows only some commands.

I thought bash history is tied to the user and not to the terminal session. What’s the probable explanation as to why not all the commands from all terminal sessions show in in bash history? I am using popOS!

https://redd.it/1ddcykx
@r_bash
Script stops when a command is run

I'm trying to run a bash noscript during which I move to a directory to run the “npm audit” command. This command seems to stop the execution of the current noscript.



The command :

npm audit --json > “$OUTPUT_FILE”

I had the same problem on Windows. The solution I found was to run the command in another instance of cmd using the command :

cmd /c npm audit --json > “%OUTPUT_FILE%”



The bash equivalent seems to be :

bash -c “ npm audit --json > ‘%OUTPUT_FILE%’

But that didn't change anything. Does anyone have any idea what's wrong?

https://redd.it/1ddh009
@r_bash
Select output by line similar to previous commands

Just like you can use the arrow keys to scroll through previous commands, is there a way to do the same for each line of output? So I don’t have to copy or type a certain value from a list of values every time I want to use it in my next command.

https://redd.it/1ddj2o0
@r_bash
mkdir with variables

I'm backing up my movie collection to my Plex server, which is running on Ubuntu Server LTS 22.04

I'm trying to write a bash noscript to create the directory and move the files over.

This is my code so far:
```
#!/bin/bash

movie="[Movie name] ([Year]) - [resolution] {imdb-[IMDb code]}"
file=$movie.mp4
path="\"/mnt/usb1/Movies/$movie\""
mkdir $path
```

But I get an error whenever trying to run it because it tries splits the directory up to a new one whenever it encounters a space, despite including double quotation marks in the "path" variable.

*The text in square brackets is only like that for the purpose of this example

Where am I going wrong?

https://redd.it/1ddp700
@r_bash
what is the command for open Browser from bash shell?

Hi, I use command whereis for get dirs of browsers, so
what is the command for use that output of whereis?
for Falkon browser whereis says it is in /usr/bin/falkon
for Chromium whereis says /snap/bin/chromium and for FF the last same snap bin.

when I put snap bin chromium bashshell angry with me and complete the screen with lots of words... sorry my no EN, so whitch will be the command for open chroium from bash shell

Thank you and Regards!

https://redd.it/1ddrqbs
@r_bash