Send data
Hello, I'm working on a project and I have a question. I want to send a DNS query from my machine. So I created a binary query with the appropriate headers. But is there a command on Linux that allows sending data, specifically a binary file, over the network, and if so, does this command include a header? Thank you for your answers. And please, only those who really know can answer.
https://redd.it/1qj2cjp
@r_bash
Hello, I'm working on a project and I have a question. I want to send a DNS query from my machine. So I created a binary query with the appropriate headers. But is there a command on Linux that allows sending data, specifically a binary file, over the network, and if so, does this command include a header? Thank you for your answers. And please, only those who really know can answer.
https://redd.it/1qj2cjp
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Custom skript for screen rotation
Hey guys. I am completely new to bash programming, but i have a small annoyance with my new device, that i want to fix:
I want to write a custom Skript that rotates the screen on my Convertible when the Lid is in the Tablet mode configuration. Acpi reads this state as :
Video/tabletmode TBLT 0000008A 00000000(Or 00000001 depending on orientation)
wmi pnp0C14:02 000000d0 00000000
wmi pnp0C14:00 000000b0 00000000
Is that enough to be easily accessed by a noscript?
I have a lenovo 7 2in1 with pop os 24.04
Has anyone any tips or Ideas?
https://redd.it/1qi7uab
@r_bash
Hey guys. I am completely new to bash programming, but i have a small annoyance with my new device, that i want to fix:
I want to write a custom Skript that rotates the screen on my Convertible when the Lid is in the Tablet mode configuration. Acpi reads this state as :
Video/tabletmode TBLT 0000008A 00000000(Or 00000001 depending on orientation)
wmi pnp0C14:02 000000d0 00000000
wmi pnp0C14:00 000000b0 00000000
Is that enough to be easily accessed by a noscript?
I have a lenovo 7 2in1 with pop os 24.04
Has anyone any tips or Ideas?
https://redd.it/1qi7uab
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Send binary file
Let me rephrase my question.
HOW DO I SEND A RAW BINARY FILE OVER THE NETWORK?
I don't need any commands that add headers or anything like that. I just have a binary file, and I want my network card to send it, that's all!
If you're wondering, the file already contains absolutely all the necessary headers for my router to understand it.
If you don't know, don't answer. Otherwise, thank you for your valuable help and answers.
https://redd.it/1qj69co
@r_bash
Let me rephrase my question.
HOW DO I SEND A RAW BINARY FILE OVER THE NETWORK?
I don't need any commands that add headers or anything like that. I just have a binary file, and I want my network card to send it, that's all!
If you're wondering, the file already contains absolutely all the necessary headers for my router to understand it.
If you don't know, don't answer. Otherwise, thank you for your valuable help and answers.
https://redd.it/1qj69co
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Serve a C
Hello, I created a mini server in local C on port 53; it's very simple.
It only works with UDP requests.
To test my server, I open a console window and run my program. I then open a second console window and run the command "nc -u IPOFMYLOCALSERVER 53" because my server is waiting on port 53 and displays the UDP request when it receives one.
To summarize:
I have a window where I launch my server.
A window where I run the command "nc -u IPOFMYLOCALSERVER 53".
And in the window where I launched the server, I expected to see the request displayed. But I never take it out again.
I think I'm doing it wrong, and that's why I'm asking for your help.
Thank you for your replies.
https://redd.it/1qk0o7g
@r_bash
Hello, I created a mini server in local C on port 53; it's very simple.
It only works with UDP requests.
To test my server, I open a console window and run my program. I then open a second console window and run the command "nc -u IPOFMYLOCALSERVER 53" because my server is waiting on port 53 and displays the UDP request when it receives one.
To summarize:
I have a window where I launch my server.
A window where I run the command "nc -u IPOFMYLOCALSERVER 53".
And in the window where I launched the server, I expected to see the request displayed. But I never take it out again.
I think I'm doing it wrong, and that's why I'm asking for your help.
Thank you for your replies.
https://redd.it/1qk0o7g
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Mastermind
Not another terminal game? Yes, well I don't have anything better to do. Anyway - hope some will find it of interest. It's just a simple Bash implementation of the old board game Mastermind.
https://github.com/StarShovel/bash-mastermind
https://preview.redd.it/blndr55g5yeg1.png?width=504&format=png&auto=webp&s=0464bdc495d45c838dbd46201e776bbb4740387e
https://preview.redd.it/l6yhqpjq5yeg1.jpg?width=653&format=pjpg&auto=webp&s=702fe9d8cbbff0c8a087119e54e4d39a5db34225
https://redd.it/1qk33x1
@r_bash
Not another terminal game? Yes, well I don't have anything better to do. Anyway - hope some will find it of interest. It's just a simple Bash implementation of the old board game Mastermind.
https://github.com/StarShovel/bash-mastermind
https://preview.redd.it/blndr55g5yeg1.png?width=504&format=png&auto=webp&s=0464bdc495d45c838dbd46201e776bbb4740387e
https://preview.redd.it/l6yhqpjq5yeg1.jpg?width=653&format=pjpg&auto=webp&s=702fe9d8cbbff0c8a087119e54e4d39a5db34225
https://redd.it/1qk33x1
@r_bash
GitHub
GitHub - StarShovel/bash-mastermind: A Bash implementation of the classic board game
A Bash implementation of the classic board game. Contribute to StarShovel/bash-mastermind development by creating an account on GitHub.
Hidden Gems: Little-Known Bash Features
https://slicker.me/bash/gems.html
https://redd.it/1qkfjls
@r_bash
https://slicker.me/bash/gems.html
https://redd.it/1qkfjls
@r_bash
slicker.me
Hidden Gems: Little-Known Bash Features
Curl Timing Confusion
I’m trying to figure out what I’ve done wrong with respect to limiting how much time curl takes to perform a single file upload.
Here’s the code I’m using.
`for i in {1..3}`
`do`
`echo $'\n'"\`date\`" Upload Attempt "$i" - $(hostname) >> "$log"`
`curl -s -S -v -u mgnewman: \`
`--connect-timeout 30 \`
`--max-time 30 \`
`--pubkey ~/.ssh/id_rsa.pub \`
`-T $file $host &>> $log`
`err=$?`
`echo $'\n'"\`date\`" Upload Ended "$err" - $(hostname) >> "$log"`
`touch /home/pi/webcam/webcam.webp`
`if [ $err -eq 0 ] ; then`
`break`
`fi`
`done`
Note that I’m using a “do loop” rather than curl’s retry option because between each iteration I want to touch an existing image file to prevent watchdog from rebooting the machine which it does if the image is not refreshed in ten minutes.
I’m trying to limit each iteration of curl to 30 seconds, but that doesn’t seem to work. Here’s a fragment of my log file:
Wed Jan 21 23:37:24 +07 2026 Upload Attempt 3 - raspcondo
\* Trying 192.nnn.nnn.101...
\* TCP\_NODELAY set
\* Connected to [xxxxxxx.com](http://xxxxxxx.com/) (192.nnn.nnn.101) port 22 (#0)
\* SSH MD5 fingerprint: 4b17cad500a405c850e118c1deec0f96
\* SSH host check: 0, key: AAAAB3NzaC1yc2EAAAADAQABAAABAQCzCyhhdYNOn5Zgib7qhPKev$
\* SSH authentication methods available: publickey,password,keyboard-interactive
\* Using SSH public key file '/home/pi/.ssh/id\_rsa.pub'
\* Using SSH private key file '/home/pi/.ssh/id\_rsa'
\* Initialized SSH public key authentication
\* Authentication complete
\* Operation timed out after 30000 milliseconds with 0 out of 0 bytes received
\* Closing connection 0
curl: (28) Operation timed out after 30000 milliseconds with 0 out of 0 bytes r$
Wed Jan 21 23:48:09 +07 2026 Upload Ended 28 - raspcondo
My conclusion is that I don’t understand how this works as it seems that around ten minutes elapsed between the time curl started (23:37:24) and the time it failed (23:48:09) with error 28.
Note that I realize the code is rather sloppy, but I’m just a hobbyist and that’s about the best I can do. Sorry.
https://redd.it/1qkjv1r
@r_bash
I’m trying to figure out what I’ve done wrong with respect to limiting how much time curl takes to perform a single file upload.
Here’s the code I’m using.
`for i in {1..3}`
`do`
`echo $'\n'"\`date\`" Upload Attempt "$i" - $(hostname) >> "$log"`
`curl -s -S -v -u mgnewman: \`
`--connect-timeout 30 \`
`--max-time 30 \`
`--pubkey ~/.ssh/id_rsa.pub \`
`-T $file $host &>> $log`
`err=$?`
`echo $'\n'"\`date\`" Upload Ended "$err" - $(hostname) >> "$log"`
`touch /home/pi/webcam/webcam.webp`
`if [ $err -eq 0 ] ; then`
`break`
`fi`
`done`
Note that I’m using a “do loop” rather than curl’s retry option because between each iteration I want to touch an existing image file to prevent watchdog from rebooting the machine which it does if the image is not refreshed in ten minutes.
I’m trying to limit each iteration of curl to 30 seconds, but that doesn’t seem to work. Here’s a fragment of my log file:
Wed Jan 21 23:37:24 +07 2026 Upload Attempt 3 - raspcondo
\* Trying 192.nnn.nnn.101...
\* TCP\_NODELAY set
\* Connected to [xxxxxxx.com](http://xxxxxxx.com/) (192.nnn.nnn.101) port 22 (#0)
\* SSH MD5 fingerprint: 4b17cad500a405c850e118c1deec0f96
\* SSH host check: 0, key: AAAAB3NzaC1yc2EAAAADAQABAAABAQCzCyhhdYNOn5Zgib7qhPKev$
\* SSH authentication methods available: publickey,password,keyboard-interactive
\* Using SSH public key file '/home/pi/.ssh/id\_rsa.pub'
\* Using SSH private key file '/home/pi/.ssh/id\_rsa'
\* Initialized SSH public key authentication
\* Authentication complete
\* Operation timed out after 30000 milliseconds with 0 out of 0 bytes received
\* Closing connection 0
curl: (28) Operation timed out after 30000 milliseconds with 0 out of 0 bytes r$
Wed Jan 21 23:48:09 +07 2026 Upload Ended 28 - raspcondo
My conclusion is that I don’t understand how this works as it seems that around ten minutes elapsed between the time curl started (23:37:24) and the time it failed (23:48:09) with error 28.
Note that I realize the code is rather sloppy, but I’m just a hobbyist and that’s about the best I can do. Sorry.
https://redd.it/1qkjv1r
@r_bash
Portable (Cartesian) brace expansion in your shell
https://neosmart.net/blog/portable-cartesian-brace-expansion-in-your-shell/
https://redd.it/1qkvy8v
@r_bash
https://neosmart.net/blog/portable-cartesian-brace-expansion-in-your-shell/
https://redd.it/1qkvy8v
@r_bash
The NeoSmart Files
Portable (Cartesian) brace expansion in your shell
Cartesian expansion, also known as brace expansion, is an incredibly powerful feature of most unixy shells, but despite being fundamentally simple and incredibly empowering, it’s been traditi…
Dear pros, as a newbie to bash noscripting, I wrote some functions to make my postgres life easier, anyone wanna review for best practices, conventions etc?
```
#!/usr/bin/env bash
# shellcheck source=/dev/null
source "${HOME}/Desktop/noscripts/logger.sh"
function run_createdb() {
if [[ -z "$(command -v createdb)" ]]; then
log_error "createdb command not found. Please ensure PostgreSQL client is installed."
return 1
fi
if [[ "$#" -lt 4 ]]; then
log_error "Usage: run_createdb <host> <port> <user> <database> [additional createdb flags]"
return 1
fi
local -r postgres_host="$1"
local -r postgres_port="$2"
local -r postgres_user="$3"
local -r postgres_database="$4"
shift 4
local -a createdb_flags=(
"--host=${postgres_host}"
"--port=${postgres_port}"
"--username=${postgres_user}"
)
createdb_flags+=("$@")
log_info "Executing createdb on database: ${postgres_database}, host: ${postgres_host}, port: ${postgres_port}, username: ${postgres_user} with flags: ${createdb_flags[*]}"
if createdb "${createdb_flags[@]}" "${postgres_database}"; then
log_info "createdb command executed successfully"
return 0
else
log_error "createdb command execution failed"
return 1
fi
}
function run_createuser() {
if [[ -z "$(command -v createuser)" ]]; then
log_error "createuser command not found. Please ensure PostgreSQL client is installed."
return 1
fi
if [[ "$#" -lt 4 ]]; then
log_error "Usage: run_createuser <host> <port> <user> <superuser> [additional createuser flags]"
return 1
fi
local -r postgres_host="$1"
local -r postgres_port="$2"
local -r postgres_user="$3"
local -r postgres_superuser="$4"
shift 4
local -a createuser_flags=(
"--host=${postgres_host}"
"--port=${postgres_port}"
"--username=${postgres_superuser}"
)
createuser_flags+=("$@")
log_info "Executing createuser on host: ${postgres_host}, port: ${postgres_port}, username: ${postgres_superuser} with flags: ${createuser_flags[*]}"
if createuser "${createuser_flags[@]}" "${postgres_user}"; then
log_info "createuser command executed successfully"
return 0
else
log_error "createuser command execution failed"
return 1
fi
}
function run_dropdb() {
if [[ -z "$(command -v dropdb)" ]]; then
log_error "dropdb command not found. Please ensure PostgreSQL client is installed."
return 1
fi
if [[ "$#" -lt 4 ]]; then
log_error "Usage: run_dropdb <host> <port> <user> <database> [additional dropdb flags]"
return 1
fi
local -r postgres_host="$1"
local -r postgres_port="$2"
local -r postgres_user="$3"
local -r postgres_database="$4"
shift 4
local -a dropdb_flags=(
"--host=${postgres_host}"
"--port=${postgres_port}"
"--username=${postgres_user}"
)
dropdb_flags+=("$@")
log_info "Executing dropdb on database: ${postgres_database}, host: ${postgres_host}, port: ${postgres_port}, username: ${postgres_user} with flags: ${dropdb_flags[*]}"
if dropdb "${dropdb_flags[@]}" "${postgres_database}"; then
log_info "dropdb command executed successfully"
return 0
else
log_error "dropdb command execution failed"
return 1
fi
}
function run_pg_dump() {
if [[ -z "$(command -v pg_dump)" ]]; then
log_error "pg_dump command not found. Please ensure PostgreSQL client is installed."
return 1
fi
if [[ "$#" -lt 4 ]]; then
log_error "Usage: run_pg_dump <host> <port> <user> <database> [additional pg_dump flags]"
return 1
fi
local -r postgres_host="$1"
local -r postgres_port="$2"
local -r postgres_user="$3"
local -r postgres_database="$4"
shift 4
local -a pg_dump_flags=(
"--dbname=${postgres_database}"
"--host=${postgres_host}"
"--port=${postgres_port}"
```
#!/usr/bin/env bash
# shellcheck source=/dev/null
source "${HOME}/Desktop/noscripts/logger.sh"
function run_createdb() {
if [[ -z "$(command -v createdb)" ]]; then
log_error "createdb command not found. Please ensure PostgreSQL client is installed."
return 1
fi
if [[ "$#" -lt 4 ]]; then
log_error "Usage: run_createdb <host> <port> <user> <database> [additional createdb flags]"
return 1
fi
local -r postgres_host="$1"
local -r postgres_port="$2"
local -r postgres_user="$3"
local -r postgres_database="$4"
shift 4
local -a createdb_flags=(
"--host=${postgres_host}"
"--port=${postgres_port}"
"--username=${postgres_user}"
)
createdb_flags+=("$@")
log_info "Executing createdb on database: ${postgres_database}, host: ${postgres_host}, port: ${postgres_port}, username: ${postgres_user} with flags: ${createdb_flags[*]}"
if createdb "${createdb_flags[@]}" "${postgres_database}"; then
log_info "createdb command executed successfully"
return 0
else
log_error "createdb command execution failed"
return 1
fi
}
function run_createuser() {
if [[ -z "$(command -v createuser)" ]]; then
log_error "createuser command not found. Please ensure PostgreSQL client is installed."
return 1
fi
if [[ "$#" -lt 4 ]]; then
log_error "Usage: run_createuser <host> <port> <user> <superuser> [additional createuser flags]"
return 1
fi
local -r postgres_host="$1"
local -r postgres_port="$2"
local -r postgres_user="$3"
local -r postgres_superuser="$4"
shift 4
local -a createuser_flags=(
"--host=${postgres_host}"
"--port=${postgres_port}"
"--username=${postgres_superuser}"
)
createuser_flags+=("$@")
log_info "Executing createuser on host: ${postgres_host}, port: ${postgres_port}, username: ${postgres_superuser} with flags: ${createuser_flags[*]}"
if createuser "${createuser_flags[@]}" "${postgres_user}"; then
log_info "createuser command executed successfully"
return 0
else
log_error "createuser command execution failed"
return 1
fi
}
function run_dropdb() {
if [[ -z "$(command -v dropdb)" ]]; then
log_error "dropdb command not found. Please ensure PostgreSQL client is installed."
return 1
fi
if [[ "$#" -lt 4 ]]; then
log_error "Usage: run_dropdb <host> <port> <user> <database> [additional dropdb flags]"
return 1
fi
local -r postgres_host="$1"
local -r postgres_port="$2"
local -r postgres_user="$3"
local -r postgres_database="$4"
shift 4
local -a dropdb_flags=(
"--host=${postgres_host}"
"--port=${postgres_port}"
"--username=${postgres_user}"
)
dropdb_flags+=("$@")
log_info "Executing dropdb on database: ${postgres_database}, host: ${postgres_host}, port: ${postgres_port}, username: ${postgres_user} with flags: ${dropdb_flags[*]}"
if dropdb "${dropdb_flags[@]}" "${postgres_database}"; then
log_info "dropdb command executed successfully"
return 0
else
log_error "dropdb command execution failed"
return 1
fi
}
function run_pg_dump() {
if [[ -z "$(command -v pg_dump)" ]]; then
log_error "pg_dump command not found. Please ensure PostgreSQL client is installed."
return 1
fi
if [[ "$#" -lt 4 ]]; then
log_error "Usage: run_pg_dump <host> <port> <user> <database> [additional pg_dump flags]"
return 1
fi
local -r postgres_host="$1"
local -r postgres_port="$2"
local -r postgres_user="$3"
local -r postgres_database="$4"
shift 4
local -a pg_dump_flags=(
"--dbname=${postgres_database}"
"--host=${postgres_host}"
"--port=${postgres_port}"
"--username=${postgres_user}"
)
pg_dump_flags+=("$@")
log_info "Executing pg_dump on database: ${postgres_database}, host: ${postgres_host}, port: ${postgres_port}, username: ${postgres_user} with flags: ${pg_dump_flags[*]}"
if pg_dump "${pg_dump_flags[@]}" "${postgres_database}"; then
log_info "pg_dump command executed successfully"
return 0
else
log_error "pg_dump command execution failed"
return 1
fi
}
function run_pg_restore() {
if [[ -z "$(command -v pg_restore)" ]]; then
log_error "pg_restore command not found. Please ensure PostgreSQL client is installed."
return 1
fi
if [[ "$#" -lt 4 ]]; then
log_error "Usage: run_pg_restore <host> <port> <user> <database> [additional pg_restore flags]"
return 1
fi
local -r postgres_host="$1"
local -r postgres_port="$2"
local -r postgres_user="$3"
local -r postgres_database="$4"
shift 4
local -a pg_restore_flags=(
"--dbname=${postgres_database}"
"--host=${postgres_host}"
"--port=${postgres_port}"
"--username=${postgres_user}"
)
pg_restore_flags+=("$@")
log_info "Executing pg_restore on database: ${postgres_database}, host: ${postgres_host}, port: ${postgres_port}, username: ${postgres_user} with flags: ${pg_restore_flags[*]}"
if pg_restore "${pg_restore_flags[@]}" "${postgres_database}"; then
log_info "pg_restore command executed successfully"
return 0
else
log_error "pg_restore command execution failed"
return 1
fi
}
function run_psql() {
if [[ -z "$(command -v psql)" ]]; then
log_error "psql command not found. Please ensure PostgreSQL client is installed."
return 1
fi
if [[ "$#" -lt 4 ]]; then
log_error "Usage: run_psql <host> <port> <user> <database> [additional psql flags]"
return 1
fi
local -r postgres_host="$1"
local -r postgres_port="$2"
local -r postgres_user="$3"
local -r postgres_database="$4"
shift 4
local -a psql_flags=(
"--dbname=${postgres_database}"
"--host=${postgres_host}"
"--port=${postgres_port}"
"--username=${postgres_user}"
)
psql_flags+=("$@")
log_info "Executing psql on database: ${postgres_database}, host: ${postgres_host}, port: ${postgres_port}, username: ${postgres_user} with flags: ${psql_flags[*]}"
if psql "${psql_flags[@]}"; then
log_info "psql command executed successfully"
return 0
else
log_error "psql command execution failed"
return 1
fi
}
```
https://redd.it/1qllq3g
@r_bash
)
pg_dump_flags+=("$@")
log_info "Executing pg_dump on database: ${postgres_database}, host: ${postgres_host}, port: ${postgres_port}, username: ${postgres_user} with flags: ${pg_dump_flags[*]}"
if pg_dump "${pg_dump_flags[@]}" "${postgres_database}"; then
log_info "pg_dump command executed successfully"
return 0
else
log_error "pg_dump command execution failed"
return 1
fi
}
function run_pg_restore() {
if [[ -z "$(command -v pg_restore)" ]]; then
log_error "pg_restore command not found. Please ensure PostgreSQL client is installed."
return 1
fi
if [[ "$#" -lt 4 ]]; then
log_error "Usage: run_pg_restore <host> <port> <user> <database> [additional pg_restore flags]"
return 1
fi
local -r postgres_host="$1"
local -r postgres_port="$2"
local -r postgres_user="$3"
local -r postgres_database="$4"
shift 4
local -a pg_restore_flags=(
"--dbname=${postgres_database}"
"--host=${postgres_host}"
"--port=${postgres_port}"
"--username=${postgres_user}"
)
pg_restore_flags+=("$@")
log_info "Executing pg_restore on database: ${postgres_database}, host: ${postgres_host}, port: ${postgres_port}, username: ${postgres_user} with flags: ${pg_restore_flags[*]}"
if pg_restore "${pg_restore_flags[@]}" "${postgres_database}"; then
log_info "pg_restore command executed successfully"
return 0
else
log_error "pg_restore command execution failed"
return 1
fi
}
function run_psql() {
if [[ -z "$(command -v psql)" ]]; then
log_error "psql command not found. Please ensure PostgreSQL client is installed."
return 1
fi
if [[ "$#" -lt 4 ]]; then
log_error "Usage: run_psql <host> <port> <user> <database> [additional psql flags]"
return 1
fi
local -r postgres_host="$1"
local -r postgres_port="$2"
local -r postgres_user="$3"
local -r postgres_database="$4"
shift 4
local -a psql_flags=(
"--dbname=${postgres_database}"
"--host=${postgres_host}"
"--port=${postgres_port}"
"--username=${postgres_user}"
)
psql_flags+=("$@")
log_info "Executing psql on database: ${postgres_database}, host: ${postgres_host}, port: ${postgres_port}, username: ${postgres_user} with flags: ${psql_flags[*]}"
if psql "${psql_flags[@]}"; then
log_info "psql command executed successfully"
return 0
else
log_error "psql command execution failed"
return 1
fi
}
```
https://redd.it/1qllq3g
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Bash Loging
#!/bin/bash
exec 19>/tmp/full_configer.log
export BASH_EXTRACEFD=19
will this send a copy of the output to the log file?
https://redd.it/1qlrtj6
@r_bash
#!/bin/bash
exec 19>/tmp/full_configer.log
export BASH_EXTRACEFD=19
will this send a copy of the output to the log file?
https://redd.it/1qlrtj6
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Most hidden "bug"?
Edit: Ok, maybe the post noscript is a bit pretentious, in hindsight even cringe (cannot edit it anymore). But the behavior is certainly weird!
I've found something truly weird, and maybe someone knowledgeable in bash's source code can help me understand this :D. If you run this command: `a(`, you will likely get ``bash: syntax error near unexpected token `newline'``. Now, run this command `<(`. It will hopefully ask for more input. Abort with Ctrl-C. Now run `a(` again. You will *from now on*, get a different error message! Namely: ``bash: syntax error near unexpected token `newline' while looking for matching `)'``.
Of course this is a niche thing that doesn't really matter, but I'm really interested in bash and maybe someone has a sound explanation for this, as it doesn't really make sense to me. It seems like bash turns a switch or something when you start but not finish a process substitution!
Here's an interactive session of what I mean:
$ a(
bash: syntax error near unexpected token `newline'
$ a((
bash: syntax error near unexpected token `('
$ <(
> ^C
$ a(
bash: syntax error near unexpected token `newline' while looking for matching `)'
$ a((
bash: syntax error near unexpected token `(' while looking for matching `)'
$ a(
bash: syntax error near unexpected token `newline' while looking for matching `)'
https://redd.it/1qly1ha
@r_bash
Edit: Ok, maybe the post noscript is a bit pretentious, in hindsight even cringe (cannot edit it anymore). But the behavior is certainly weird!
I've found something truly weird, and maybe someone knowledgeable in bash's source code can help me understand this :D. If you run this command: `a(`, you will likely get ``bash: syntax error near unexpected token `newline'``. Now, run this command `<(`. It will hopefully ask for more input. Abort with Ctrl-C. Now run `a(` again. You will *from now on*, get a different error message! Namely: ``bash: syntax error near unexpected token `newline' while looking for matching `)'``.
Of course this is a niche thing that doesn't really matter, but I'm really interested in bash and maybe someone has a sound explanation for this, as it doesn't really make sense to me. It seems like bash turns a switch or something when you start but not finish a process substitution!
Here's an interactive session of what I mean:
$ a(
bash: syntax error near unexpected token `newline'
$ a((
bash: syntax error near unexpected token `('
$ <(
> ^C
$ a(
bash: syntax error near unexpected token `newline' while looking for matching `)'
$ a((
bash: syntax error near unexpected token `(' while looking for matching `)'
$ a(
bash: syntax error near unexpected token `newline' while looking for matching `)'
https://redd.it/1qly1ha
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Are there any high leverage ways to get good ctrl r in a terminal?
I have to deal with a lot of minimal containers. Some, I straight up don't control (proprietary cloud simulations). Some I do control technically... but it's a PITA to maintain all my configs and integrate them with the container easily and reliably (especially if dependencies aren't installed on said machine), through version upgrades. Sometimes I just want to spin up a container just cuz.
For reference, another extremely high leverage option is vi mode:
I just copy this in the start of any minimal bash session (or even just set -o vi, but this is automatable with tmux) and I'm basically chilling.
Sure, fzf is great, but it depends on git being installed. I mean, not really a big deal, but still, a dependency (e.g. now you need internet access, remember the package manager for the OS, it needs to have git, etc.) Furthermore, I want to sort of push the limits of bash - are there any wizards that know a lot about obscure bash features that could hack something up that's "simple" (two stages: one is obviously just minimal characters, but any solution that you can just copy paste into a bash terminal in a single line, no matter how hackily, is good enough for me IMO)
Yes, I know normal ctrl r, no, I don't like it mainly because it doesn't show me multiple options at once. My memory is really bad LOL, but maybe I just get used to it (fzf is an actual gamechanger fr tho)
---
EDIT because I think i'm shadowbanned from my own post for some reason but:
the use case is when you spin up various interactive containers potentially hundreds of times a day, don't have control over the exact launch params (or more precisely, maintaining custom configs layered on top of the containers is either hacky as version upgrades happen, or it straight up is impossible like in secure proprietary cloud simulations) and don't want to deal with vanilla bash.
the challenge is to find a good balance
my config in general (if I were say, installing configs fully on a home computer I control) is already very minimal already, but this is going even further.
in general:
- mounting is forbidden in general (if I could mount, I'd just install my configs lol)
- internet is okay, but the point is no internet. yes I am aware git clone fzf + install, the point of the post is that we aren't going this route. take it or leave it lol. that's why I asked specifically on the r/bash subreddit, if there were any bash wizards who had custom ctrl R setups, curious
set -o vi, for example, is a setting on most containers that exists, requires no internet, and is high leverage for me (as someone who lives perma in the command line).
fzf is also very high leverage for me. but I'm saying, assume we aren't allowed to use fzf, what can we do
https://redd.it/1qqo2ce
@r_bash
I have to deal with a lot of minimal containers. Some, I straight up don't control (proprietary cloud simulations). Some I do control technically... but it's a PITA to maintain all my configs and integrate them with the container easily and reliably (especially if dependencies aren't installed on said machine), through version upgrades. Sometimes I just want to spin up a container just cuz.
For reference, another extremely high leverage option is vi mode:
set -o vi; bind 'set vi-ins-mode-string \1\e[6 q\2'; bind 'set vi-cmd-mode-string \1\e[2 q\2';
I just copy this in the start of any minimal bash session (or even just set -o vi, but this is automatable with tmux) and I'm basically chilling.
Sure, fzf is great, but it depends on git being installed. I mean, not really a big deal, but still, a dependency (e.g. now you need internet access, remember the package manager for the OS, it needs to have git, etc.) Furthermore, I want to sort of push the limits of bash - are there any wizards that know a lot about obscure bash features that could hack something up that's "simple" (two stages: one is obviously just minimal characters, but any solution that you can just copy paste into a bash terminal in a single line, no matter how hackily, is good enough for me IMO)
Yes, I know normal ctrl r, no, I don't like it mainly because it doesn't show me multiple options at once. My memory is really bad LOL, but maybe I just get used to it (fzf is an actual gamechanger fr tho)
---
EDIT because I think i'm shadowbanned from my own post for some reason but:
the use case is when you spin up various interactive containers potentially hundreds of times a day, don't have control over the exact launch params (or more precisely, maintaining custom configs layered on top of the containers is either hacky as version upgrades happen, or it straight up is impossible like in secure proprietary cloud simulations) and don't want to deal with vanilla bash.
the challenge is to find a good balance
my config in general (if I were say, installing configs fully on a home computer I control) is already very minimal already, but this is going even further.
in general:
- mounting is forbidden in general (if I could mount, I'd just install my configs lol)
- internet is okay, but the point is no internet. yes I am aware git clone fzf + install, the point of the post is that we aren't going this route. take it or leave it lol. that's why I asked specifically on the r/bash subreddit, if there were any bash wizards who had custom ctrl R setups, curious
set -o vi, for example, is a setting on most containers that exists, requires no internet, and is high leverage for me (as someone who lives perma in the command line).
fzf is also very high leverage for me. but I'm saying, assume we aren't allowed to use fzf, what can we do
https://redd.it/1qqo2ce
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Locked out of local admin account - need to recover Wi-Fi network details
Hi everyone,
I’ve found my old laptop running Windows 10/11, but I’ve completely forgotten the local administrator password. I can log in as a standard user, but I need admin rights to see the Wi-Fi password for the network I'm currently connected to (using the netsh wlan show profile command).
Since it’s a local account not linked to Microsoft, I’m looking for a way to reset the admin password or gain enough privileges to run CMD as admin without wiping my data. Are tools like Hiren’s BootCD or the "utilman" method still working on recent updates?
Thanks for any advice!
https://redd.it/1qqyc1c
@r_bash
Hi everyone,
I’ve found my old laptop running Windows 10/11, but I’ve completely forgotten the local administrator password. I can log in as a standard user, but I need admin rights to see the Wi-Fi password for the network I'm currently connected to (using the netsh wlan show profile command).
Since it’s a local account not linked to Microsoft, I’m looking for a way to reset the admin password or gain enough privileges to run CMD as admin without wiping my data. Are tools like Hiren’s BootCD or the "utilman" method still working on recent updates?
Thanks for any advice!
https://redd.it/1qqyc1c
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Tcl: The Most Underrated, But The Most Productive Programming Language (like Bash)
https://medium.com/gitconnected/tcl-the-most-underrated-but-the-most-productive-programming-language-1f83c99eaab7?sk=de732f41d473339dc31ee7481a8ba526
https://redd.it/1qqyq44
@r_bash
https://medium.com/gitconnected/tcl-the-most-underrated-but-the-most-productive-programming-language-1f83c99eaab7?sk=de732f41d473339dc31ee7481a8ba526
https://redd.it/1qqyq44
@r_bash
Medium
Tcl: The Most Underrated, But The Most Productive Programming Language
The only well-modernized command language that you can use literally for anything
UTKeeper99 a advanced Linux Unreal Tournament and Webservices Tool
\# Features Highlights:
\# - First-Run Auto-Config Detection (should reject critical system paths)
\# - DryRun Mode for safe testing
\# - Recursive Archive Extraction (up to 10 levels deep)
\# - Smart File Collection (gathers all UT files from subdirs)
\# - Disk Space Validation before Backup
\# - Backup Management (List, Delete by age, etc.)
\# - Distribution of Maps to UT Server and Webserver
\# - Cloning Maps (you like CTF-Face? or a MH Map ? now play that as DM/TDM map)
\# - Name fixes (case sensitive for Linux) + chmod/chown defaults for UT/Web
\# - Advanced UT and Webserver Orphan Cleaning Tool
\# - Modular design for easy expansion/customization.
\#
https://github.com/KoDProm/utkeeper99
https://redd.it/1qq6ewo
@r_bash
\# Features Highlights:
\# - First-Run Auto-Config Detection (should reject critical system paths)
\# - DryRun Mode for safe testing
\# - Recursive Archive Extraction (up to 10 levels deep)
\# - Smart File Collection (gathers all UT files from subdirs)
\# - Disk Space Validation before Backup
\# - Backup Management (List, Delete by age, etc.)
\# - Distribution of Maps to UT Server and Webserver
\# - Cloning Maps (you like CTF-Face? or a MH Map ? now play that as DM/TDM map)
\# - Name fixes (case sensitive for Linux) + chmod/chown defaults for UT/Web
\# - Advanced UT and Webserver Orphan Cleaning Tool
\# - Modular design for easy expansion/customization.
\#
https://github.com/KoDProm/utkeeper99
https://redd.it/1qq6ewo
@r_bash
GitHub
GitHub - KoDProm/utkeeper99: UTKeeper99 a linux based Unreal Tournament and local Webdirect Management Service Tool
UTKeeper99 a linux based Unreal Tournament and local Webdirect Management Service Tool - KoDProm/utkeeper99
Limiting internet access on machine through BASH
Okay, I have NO idea where to post this now. Please, if this is NOT relevant to this subreddit, could anyone direct me to an appropriate subreddit.
If anyone can solve it, I will be so grateful!
I am trying to limit internet on my maching from 8AM to 10PM via powershell. I used GPT to help.
So here are some commands that work
To create internet kill switch on laptop:
To kill internet on laptop (test to show that it work)
To enable internet on laptop (test to show that it works)
However, the following does not work. I assume that it doesn't work when the machine is off.
To UNblock internet at 8:00AM, task called "EnableInternet"
I tried to edit it so that it checks the time every minute. That way if the machine is turned on AFTER 8AM, it works. But the following does NOT work
Similar for blocking the internet at midday.
I bet there are other issues, Like if both commands even worked, maybe the internet would just switch on and off?
I am so lost here guys, let me know if you have any solutions.
Inb4 why not just remove the internet: I only need the internet between 8AM and midday.
https://redd.it/1qqoyt0
@r_bash
Okay, I have NO idea where to post this now. Please, if this is NOT relevant to this subreddit, could anyone direct me to an appropriate subreddit.
If anyone can solve it, I will be so grateful!
I am trying to limit internet on my maching from 8AM to 10PM via powershell. I used GPT to help.
So here are some commands that work
To create internet kill switch on laptop:
netsh advfirewall firewall add rule name="InternetKillSwitch" dir=out action=block protocol=anyTo kill internet on laptop (test to show that it work)
netsh advfirewall firewall set rule name="InternetKillSwitch" new enable=yesTo enable internet on laptop (test to show that it works)
netsh advfirewall firewall set rule name="InternetKillSwitch" new enable=noHowever, the following does not work. I assume that it doesn't work when the machine is off.
To UNblock internet at 8:00AM, task called "EnableInternet"
schtasks /create /sc daily /st 08:00 /ru SYSTEM /rl HIGHEST /tn "EnableInternet" /tr "powershell -command \"netsh advfirewall firewall set rule name='InternetKillSwitch' new enable=no\""I tried to edit it so that it checks the time every minute. That way if the machine is turned on AFTER 8AM, it works. But the following does NOT work
schtasks /create /sc daily /st 08:00 /ru SYSTEM /rl HIGHEST /tn "EnableInternet" /tr "powershell -command \"netsh advfirewall firewall set rule name='InternetKillSwitch' new enable=no\"" /ri 1 /du 24:00Similar for blocking the internet at midday.
schtasks /create /sc daily /st 12:00 /ru SYSTEM /rl HIGHEST /tn "EnableInternet" /tr "powershell -command \"netsh advfirewall firewall set rule name='InternetKillSwitch' new enable=no\"" /ri 1 /du 24:00I bet there are other issues, Like if both commands even worked, maybe the internet would just switch on and off?
I am so lost here guys, let me know if you have any solutions.
Inb4 why not just remove the internet: I only need the internet between 8AM and midday.
https://redd.it/1qqoyt0
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How to kill a noscript after it runs awhile from another noscript
Hi,
I have a noscript that runs on startup that I will want to kill to run another one(later on) via cron.
Can't figure out how to kill the first noscript programatically.
Say the noscript is: ~/noscripts/default.sh
and I want to kill it, what is a predictable way to kill said noscript. I know of ps and pkill but I hit a wall. I don't know the steps(or commands?) involved to do this accurately.
Thanks in advance.
https://redd.it/1qowblg
@r_bash
Hi,
I have a noscript that runs on startup that I will want to kill to run another one(later on) via cron.
Can't figure out how to kill the first noscript programatically.
Say the noscript is: ~/noscripts/default.sh
and I want to kill it, what is a predictable way to kill said noscript. I know of ps and pkill but I hit a wall. I don't know the steps(or commands?) involved to do this accurately.
Thanks in advance.
https://redd.it/1qowblg
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
SS64
I've been using the command line for 26 years and I've seen lots of good tips and tricks guides. My favorite by far is ss64.com. I actually originally found it when I was looking for help with Windows batch noscripting, but it has good stuff about Linux and Bash, too.
https://redd.it/1qo2bp1
@r_bash
I've been using the command line for 26 years and I've seen lots of good tips and tricks guides. My favorite by far is ss64.com. I actually originally found it when I was looking for help with Windows batch noscripting, but it has good stuff about Linux and Bash, too.
https://redd.it/1qo2bp1
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Code Optimization Suggestions Welcome
Howdy bash friends,
Inspired by the goodwork of people in the ZSA and ploopy communities I whipped together some improvements to the moonlander (keyboard) spin of the ploopy nano (trackball) BTU mod, and I wrote a little noscript and a systemd .service file that use the api ZSA made to manage communication between the trackball and my moonlander, so that moving the trackball activates a mouse layer on my keyboard,
Honestly it's pretty sweet, very snappy and responsive, but I was wondering if some bored soul with a deep knowledge of bash built-in's was willing to take a look and let me know if I missed some low-hanging fruit to optimize my code?
https://preview.redd.it/lgbguzx6jmfg1.jpg?width=4624&format=pjpg&auto=webp&s=57ee3e3b9a0c65e30634b982aed7fb23106a1b1a
Posted on github here
https://redd.it/1qn6hkf
@r_bash
Howdy bash friends,
Inspired by the goodwork of people in the ZSA and ploopy communities I whipped together some improvements to the moonlander (keyboard) spin of the ploopy nano (trackball) BTU mod, and I wrote a little noscript and a systemd .service file that use the api ZSA made to manage communication between the trackball and my moonlander, so that moving the trackball activates a mouse layer on my keyboard,
Honestly it's pretty sweet, very snappy and responsive, but I was wondering if some bored soul with a deep knowledge of bash built-in's was willing to take a look and let me know if I missed some low-hanging fruit to optimize my code?
https://preview.redd.it/lgbguzx6jmfg1.jpg?width=4624&format=pjpg&auto=webp&s=57ee3e3b9a0c65e30634b982aed7fb23106a1b1a
Posted on github here
https://redd.it/1qn6hkf
@r_bash