Questions about netcat and ports
Hi there,
I am testing the program netcat and I see something that I do not understand so here I am.
I listen to some ports with :
Assuming nc will listen to tcp by default.
Then I send data into a listened port :
The output :
The question, why is nc responding that the data is received at 127.0.0.1 51404, what is this port ? Same, if I send into port 2070, it will answer at 40630 ? etc..
EDIT : it exits with error code 130
https://redd.it/1i33ysk
@r_bash
Hi there,
I am testing the program netcat and I see something that I do not understand so here I am.
I listen to some ports with :
for j in 20{0..9}{0..5}; do nc -lvn `127.0.0.1` $j & doneAssuming nc will listen to tcp by default.
Then I send data into a listened port :
echo lol | nc `127.0.0.1` 2095The output :
Connection received on `127.0.0.1` 51404lolThe question, why is nc responding that the data is received at 127.0.0.1 51404, what is this port ? Same, if I send into port 2070, it will answer at 40630 ? etc..
EDIT : it exits with error code 130
https://redd.it/1i33ysk
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
what about "case-ignore"?
Hi, why not bash ignore uppercase!
vim or VIM opens vim
ls/LS idem...
exit/EX..
ETC..
I don't know about submission flag maybe was a wrong flag
Regards!
https://redd.it/1i3hwtb
@r_bash
Hi, why not bash ignore uppercase!
vim or VIM opens vim
ls/LS idem...
exit/EX..
ETC..
I don't know about submission flag maybe was a wrong flag
Regards!
https://redd.it/1i3hwtb
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
how to catch status code of killed process by bash noscript
Hi every one, I am working on project, and I faced an a issue, the issue is that I cannot catch the exit code "status code" of process that worked in background, take this program as an example, that exits with 99 if it received a sigint, the code:
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
void bye(){
// exit with code 99 if sigint was received
exit(99);
}
int main(int argc,char** argv){
signal(SIGINT, bye);
while(1){
sleep(1);
}
return 0;
}
then I compiled it using
\`gcc example.c -o byeprogram\`
in the same directory, I have my bash noscript:
set -x
__do_before_wait(){
##some commands
return 0
}
__do_after_trap(){
##some commands
return 0
}
runbg() {
local __start_time __finish_time __run_time
__start_time=$(date +%s.%N)
# Run the command in the background
($@) &
__pid=$!
trap '
kill -2 $__pid
echo $?
__finish_time=$(date +%s.%N)
__run_time=$(echo "$__finish_time - $__start_time" | bc -l)
echo "$__run_time"
__do_after_trap || exit 2
' SIGINT
__do_before_wait || exit 1
wait $__pid
## now if you press ctrl+c, it will execute the commands i wrote in trap
}
out=`runbg /path/to/byeprogram`
my problem is I want to catch or print the code 99, but I cannot, I tried to execute the \`byeprogram\` from the terminal, and type ctrl+c, and it return 99, how to catch the 99 status code??
https://redd.it/1i3isxg
@r_bash
Hi every one, I am working on project, and I faced an a issue, the issue is that I cannot catch the exit code "status code" of process that worked in background, take this program as an example, that exits with 99 if it received a sigint, the code:
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
void bye(){
// exit with code 99 if sigint was received
exit(99);
}
int main(int argc,char** argv){
signal(SIGINT, bye);
while(1){
sleep(1);
}
return 0;
}
then I compiled it using
\`gcc example.c -o byeprogram\`
in the same directory, I have my bash noscript:
set -x
__do_before_wait(){
##some commands
return 0
}
__do_after_trap(){
##some commands
return 0
}
runbg() {
local __start_time __finish_time __run_time
__start_time=$(date +%s.%N)
# Run the command in the background
($@) &
__pid=$!
trap '
kill -2 $__pid
echo $?
__finish_time=$(date +%s.%N)
__run_time=$(echo "$__finish_time - $__start_time" | bc -l)
echo "$__run_time"
__do_after_trap || exit 2
' SIGINT
__do_before_wait || exit 1
wait $__pid
## now if you press ctrl+c, it will execute the commands i wrote in trap
}
out=`runbg /path/to/byeprogram`
my problem is I want to catch or print the code 99, but I cannot, I tried to execute the \`byeprogram\` from the terminal, and type ctrl+c, and it return 99, how to catch the 99 status code??
https://redd.it/1i3isxg
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Give a markdown file and create files based on that: Is this possible?
Filename.java
Filename2.java
Filename3.java
The file looks like this. I know chatgpt can do this but I really want myself to learn bash the last time.
- Read the file with read -a command
- when encountered a first-name keep it as touch Filename.java
- Then everything between three backticks are echoed inside that filename.java
And so on.. Do this till you reach last of file.
https://redd.it/1i43g9m
@r_bash
Filename.java
code goes here
Filename2.java
code goes here
Filename3.java
code goes here
The file looks like this. I know chatgpt can do this but I really want myself to learn bash the last time.
- Read the file with read -a command
- when encountered a first-name keep it as touch Filename.java
- Then everything between three backticks are echoed inside that filename.java
And so on.. Do this till you reach last of file.
https://redd.it/1i43g9m
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
I made a simple note taking in bash noscript that utilizes fzf.
Script Repo
Demo
https://preview.redd.it/pl20rbq8lpde1.png?width=860&format=png&auto=webp&s=105a9506b2af4736f12675926c09aeef25f543dd
https://preview.redd.it/mblhvcq8lpde1.png?width=860&format=png&auto=webp&s=3191b2172a80f1dd84aa69c98975494c60a56363
https://preview.redd.it/eu6dheq8lpde1.png?width=860&format=png&auto=webp&s=82136a650b18015a2e7770c2228130a8c6738e76
https://redd.it/1i42s0q
@r_bash
Script Repo
Demo
https://preview.redd.it/pl20rbq8lpde1.png?width=860&format=png&auto=webp&s=105a9506b2af4736f12675926c09aeef25f543dd
https://preview.redd.it/mblhvcq8lpde1.png?width=860&format=png&auto=webp&s=3191b2172a80f1dd84aa69c98975494c60a56363
https://preview.redd.it/eu6dheq8lpde1.png?width=860&format=png&auto=webp&s=82136a650b18015a2e7770c2228130a8c6738e76
https://redd.it/1i42s0q
@r_bash
GitHub
GitHub - JianZcar/notes-bash: A simple note taking tui bash noscript powered by fzf
A simple note taking tui bash noscript powered by fzf - JianZcar/notes-bash
how to change prompt(+command) just before execution (PS0)
Hi, it is easy to invert the colors of my prompt+command:
https://redd.it/1i3pr9t
@r_bash
Hi, it is easy to invert the colors of my prompt+command:
PS1="\e[7m> "; PS0="\e[27m". I want to achieve this look, but only after hitting enter. Does anyone have an idea how to achieve this?https://redd.it/1i3pr9t
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Recommendations for optimizations to bash alias
I created a simple alias to list contents of a folder. It just makes life easier for me.
It works pretty well, however, it's not instant. Nor is it really "semi instant". If I have a folder of about 30 or so items (mixed between folders, files, symlinks, etc). It takes a good 5-7 seconds to list everything.
So the question becomes, is their a more effecient way of doing this. I threw everything inside the function so it is easier to read, so it needs cleaned.
Initially I was using sed for replacements, I read online that awk is faster, and I had originally used multiple steps to replace. Once I switched to awk, I added all the replacements to a single command, hoping to speed it up.
And originally, I was using a single stat command, and using all of the flags, but then if you had files of different lengths, then it started to look like jenga, with the columns mis-aligned. That's when I broke it up into different calls, that way I could format it with printf.
Originally it was:
So I'm assuming that the most costly action here, is the constant need to re-run stat in order to grab another piece of information.
Any pointers would be great. Hopefully I can get this semi-fast. It seems stupid, but it really helps with seeing my data.
https://redd.it/1i4nou3
@r_bash
I created a simple alias to list contents of a folder. It just makes life easier for me.
alias perms="perms"
function perms
{
END=$'\e[0m'
FUCHSIA2=$'\e[38;5;198m'
GREEN=$'\e[38;5;2m'
GREY2=$'\e[38;5;244m'
for f in *; do
ICON=$(stat -c '%F' $f)
NAME=$(stat -c '%n' $f)
PERMS=$(stat -c '%A %a' $f)
FILESIZE=$(du -sh $f | awk '{ print $1}')
UGROUP=$(stat -c '%U:%G' $f)
ICON=$(awk '{gsub(/symbolic link/,"🔗");gsub(/regular empty file/,"⭕");gsub(/regular file/,"📄");gsub(/directory/,"📁")}1' <<<"$ICON")
printf '%-10s %-50s %-17s %-22s %-30s\n' "${END} ${ICON}" "${GREEN}${NAME}${END}" "${PERMS}" "${GREY2}${FILESIZE}${END}" "${FUCHSIA2}${UGROUP}${END}"
done;
}
It works pretty well, however, it's not instant. Nor is it really "semi instant". If I have a folder of about 30 or so items (mixed between folders, files, symlinks, etc). It takes a good 5-7 seconds to list everything.
So the question becomes, is their a more effecient way of doing this. I threw everything inside the function so it is easier to read, so it needs cleaned.
Initially I was using sed for replacements, I read online that awk is faster, and I had originally used multiple steps to replace. Once I switched to awk, I added all the replacements to a single command, hoping to speed it up.
And originally, I was using a single stat command, and using all of the flags, but then if you had files of different lengths, then it started to look like jenga, with the columns mis-aligned. That's when I broke it up into different calls, that way I could format it with printf.
Originally it was:
file=$(stat -c ' %F %A %a %U:%G %n' $1)
So I'm assuming that the most costly action here, is the constant need to re-run stat in order to grab another piece of information.
Any pointers would be great. Hopefully I can get this semi-fast. It seems stupid, but it really helps with seeing my data.
https://redd.it/1i4nou3
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
I made a noscript to automate Encrypted Journaling with GPG2
https://github.com/Medom5/encrypted-journaling
https://redd.it/1i4du4d
@r_bash
https://github.com/Medom5/encrypted-journaling
https://redd.it/1i4du4d
@r_bash
GitHub
GitHub - Medom5/encrypted-journaling: A shell noscript to automate encrypted journaling with GPG.
A shell noscript to automate encrypted journaling with GPG. - Medom5/encrypted-journaling
Export ain't working I'm so confused
So apparently if you change a variable and then export it, then say you open a new terminal then the variable would have changed, but this didn't work for me, even with child processes like so:
I did:
PS1="Bash is cool! "
export PS1
Then:
qterminal
but the shell prompt was still default
and even if I did the following but instead of qterminal I wrote "bash" (to show a new prompt), then it was still the same.
Why???
https://redd.it/1i5gder
@r_bash
So apparently if you change a variable and then export it, then say you open a new terminal then the variable would have changed, but this didn't work for me, even with child processes like so:
I did:
PS1="Bash is cool! "
export PS1
Then:
qterminal
but the shell prompt was still default
and even if I did the following but instead of qterminal I wrote "bash" (to show a new prompt), then it was still the same.
Why???
https://redd.it/1i5gder
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Help with Permission Issue in Bash Script (Cronjob)
Hey everyone, I’ve been stuck on an issue for a while and hope someone here can help me out. I’m trying to run a Bash noscript with Cron that creates Restic backups and stores a PID file. However, I keep getting the following error: Line 60: /var/tmp/restic_backup.pid: Permission denied I’ve already verified that /var/tmp/ has the correct permissions: drwxrwxrwt 16 root root 4096 Jan 20 10:50 /var/tmp The cron job is running as the correct user (poan). I’ve also tried changing the noscript to write in other directories like /tmp/ or /home/poan/tmp/, but the error still persists. Does anyone have any ideas on what I might be overlooking or what else I can try to resolve the issue? Any tips would be greatly appreciated! Thanks in advance!
https://redd.it/1i5n4c1
@r_bash
Hey everyone, I’ve been stuck on an issue for a while and hope someone here can help me out. I’m trying to run a Bash noscript with Cron that creates Restic backups and stores a PID file. However, I keep getting the following error: Line 60: /var/tmp/restic_backup.pid: Permission denied I’ve already verified that /var/tmp/ has the correct permissions: drwxrwxrwt 16 root root 4096 Jan 20 10:50 /var/tmp The cron job is running as the correct user (poan). I’ve also tried changing the noscript to write in other directories like /tmp/ or /home/poan/tmp/, but the error still persists. Does anyone have any ideas on what I might be overlooking or what else I can try to resolve the issue? Any tips would be greatly appreciated! Thanks in advance!
https://redd.it/1i5n4c1
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Command substitution problem
I do have a problem that drives me crazy:
I have a binary that needs to be run in a bash noscript, but in some case fails and then needs to be run in a chroot for the rest of the noscript.
When it first fails I set a variable RUN_IN_CHROOT=yes.
I catch the output of the binary via command substitution.
So my noscript looks like this:
MY_BINARY=/path/to/binary
mode=$(${MY_BINARY} -m $param1)
If that doesn't work:
RUN_IN_CHROOT=yes
mode=$(${RUN_IN_CHROOT:+chroot} ${RUN_IN_CHROOT:+/mnt} ${MY_BINARY} -m $param1)
So from this point every call to the binary has the RUN_IN_CHROOT checks and should prepend the chroot /mnt.
But I get the error: chroot /mnt: No such file or directory
It treats both as a single command, which can obviously not be found.
When I run with bash -x I see that it tries to call 'chroot /mnt' /path/to/binary -m 8
Why does it encapsulate it in this weird way, and how can I stop it from doing so?
Thanks for your help.
Sorry for the lack of formatting.
https://redd.it/1i5ohag
@r_bash
I do have a problem that drives me crazy:
I have a binary that needs to be run in a bash noscript, but in some case fails and then needs to be run in a chroot for the rest of the noscript.
When it first fails I set a variable RUN_IN_CHROOT=yes.
I catch the output of the binary via command substitution.
So my noscript looks like this:
MY_BINARY=/path/to/binary
mode=$(${MY_BINARY} -m $param1)
If that doesn't work:
RUN_IN_CHROOT=yes
mode=$(${RUN_IN_CHROOT:+chroot} ${RUN_IN_CHROOT:+/mnt} ${MY_BINARY} -m $param1)
So from this point every call to the binary has the RUN_IN_CHROOT checks and should prepend the chroot /mnt.
But I get the error: chroot /mnt: No such file or directory
It treats both as a single command, which can obviously not be found.
When I run with bash -x I see that it tries to call 'chroot /mnt' /path/to/binary -m 8
Why does it encapsulate it in this weird way, and how can I stop it from doing so?
Thanks for your help.
Sorry for the lack of formatting.
https://redd.it/1i5ohag
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
I made a simple "UI Library" for bash called basil. And a small helper for sourcing the library and creating a ready to run file.
Black and white mode
normal mode
retro mode
BASIL
https://redd.it/1i5sn8w
@r_bash
Black and white mode
normal mode
retro mode
BASIL
https://redd.it/1i5sn8w
@r_bash
rmdir "No such file or directory" but ls shows folder isn't empty
I am trying to clean up some old media files.
When I use ls to show the contents of my current folder, it lists one folder. When I use rmdir to remove that folder, it states:
ls: folder: No such file or directory
How do I get rid of the target directory?
https://redd.it/1i61br6
@r_bash
I am trying to clean up some old media files.
When I use ls to show the contents of my current folder, it lists one folder. When I use rmdir to remove that folder, it states:
ls: folder: No such file or directory
How do I get rid of the target directory?
https://redd.it/1i61br6
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Error oh my bash theme development
Good evening everyone, I'm making another theme for Oh My Bash that has the same base as my old theme, but it's not overwriting the base properly, these are the codes
New theme
Base theme
The prompt gets all buggy, it looks like this
https://redd.it/1i6wedj
@r_bash
Good evening everyone, I'm making another theme for Oh My Bash that has the same base as my old theme, but it's not overwriting the base properly, these are the codes
New theme
if [ -z "${NEKONIGHT_BASE_LOADED}" ]; then
source ~/.oh-my-bash/themes/nekonight/nekonight-base.sh
export NEKONIGHT_BASE_LOADED=true
fi
icon_start="╭─"
icon_user=" 🌙 ${_omb_prompt_bold_olive}\u${_omb_prompt_normal}"
icon_host=" at 🌙 ${_omb_prompt_bold_cyan}\h${_omb_prompt_normal}"
icon_directory=" in 🌙 ${_omb_prompt_bold_magenta}\w${_omb_prompt_normal}"
icon_end="╰─${_omb_prompt_bold_white}λ${_omb_prompt_normal}"
_omb_theme_nekonight_git_prompt_info
_omb_theme_nekonight_scm_git_status
function _omb_theme_PROMPT_COMMAND() {
PS1="${icon_start}${icon_user}${icon_host}${icon_directory} in $(_omb_theme_nekonight_git_prompt_info)\n${icon_end} "
}
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
Base theme
shell
icon_start="╭─"
icon_user=" 🐱 ${_omb_prompt_bold_olive}\u${_omb_prompt_normal}"
icon_host=" at 🐱 ${_omb_prompt_bold_cyan}\h${_omb_prompt_normal}"
icon_directory=" in 🐱 ${_omb_prompt_bold_magenta}\w${_omb_prompt_normal}"
icon_end="╰─${_omb_prompt_bold_white}λ${_omb_prompt_normal}"
function _omb_theme_nekonight_git_prompt_info() {
local branch_name
branch_name=$(git symbolic-ref --short HEAD 2>/dev/null)
local git_status=""
if [[ -n $branch_name ]]; then
git_status="${_omb_prompt_bold_white}(🐱 $branch_name $(_omb_theme_nekonight_scm_git_status))${_omb_prompt_normal}"
fi
echo -n "$git_status"
}
function _omb_theme_nekonight_scm_git_status() {
local git_status=""
if git rev-list --count --left-right @{upstream}...HEAD 2>/dev/null | grep -Eq '^[0-9]+\s[0-9]+$'; then
git_status+="${_omb_prompt_brown}↓${_omb_prompt_normal} "
fi
if [[ -n $(git diff --cached --name-status 2>/dev/null) ]]; then
git_status+="${_omb_prompt_green}+${_omb_prompt_normal}"
fi
if [[ -n $(git diff --name-status 2>/dev/null) ]]; then
git_status+="${_omb_prompt_yellow}•${_omb_prompt_normal}"
fi
if [[ -n $(git ls-files --others --exclude-standard 2>/dev/null) ]]; then
git_status+="${_omb_prompt_red}⌀${_omb_prompt_normal}"
fi
echo -n "$git_status"
}
The prompt gets all buggy, it looks like this
\\\[\\e\[97;1m\\\](🐱 main \\\[\\e\[0;31m\\\]↓\\\[\\e\[0m\\\] \\\[\\e\[0;93m\\\]•\\\[\\e\[0m\\\]\\\[\\e\[0;91m\\\]⌀\\\[\\e\[0m\\\])\\\[\\e\[0m\\\]\\\[\\e\[0;31m\\\]↓\\\[\\e\[0m\\\] \\\[\\e\[0;93m\\\]•\\\[\\e\[0m\\\]\\\[\\e\[0m\\\]╭─ 🌙 brunociccarino at 🌙 DESKTOP-27DNBRN in 🌙 \~ in (🐱 main ↓ •⌀)
╰─λ
https://redd.it/1i6wedj
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
style enforcement tool?
Hi folks, looking for a sh and bash enforcement tool. I found bashate but seems too limited.
https://redd.it/1i5yexv
@r_bash
Hi folks, looking for a sh and bash enforcement tool. I found bashate but seems too limited.
https://redd.it/1i5yexv
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Sed replacement with a variable needs single and double quotes
Hi all, this may be a stupid question, so sorry in advance. I have just started to get into the world of bash noscripting, and I decided to create an install noscript for my NixOS build. Within that, I want to create a new host, so I have decided to use
From what I could find when googling this, I need to exit the single quotes with double quotes when writing the expression, then go back to singles to finish it.
https://askubuntu.com/questions/1390037/using-sed-with-a-variable-inside-double-quote
So this is what i have so far
https://redd.it/1i8te4k
@r_bash
Hi all, this may be a stupid question, so sorry in advance. I have just started to get into the world of bash noscripting, and I decided to create an install noscript for my NixOS build. Within that, I want to create a new host, so I have decided to use
sed to add a block of Nix code from a text file in place of a comment that I have there by default. The problem arises then that I need to evaluate bash noscript within it using double quotes "" as well as using the s option at the start, which from what I can see only works with single quotes ''. From what I could find when googling this, I need to exit the single quotes with double quotes when writing the expression, then go back to singles to finish it.
https://askubuntu.com/questions/1390037/using-sed-with-a-variable-inside-double-quote
So this is what i have so far
sudo sed -i 's|#Install new host hook|'"$(< /etc/nixos/noscripts/helperFiles/newHostFlakeBlock.txt)"'|' /etc/nixos/flake.nixhttps://redd.it/1i8te4k
@r_bash
Ask Ubuntu
Using sed with a variable inside double quote
I have a file input.xml which contains a line: <exciton lambda="1" fix="hole"/>
in that line I want to replace 1 with 2 but I can't use just 1 as key word since there are ...
in that line I want to replace 1 with 2 but I can't use just 1 as key word since there are ...
Creating a simple latex launcher
Hello!
I'm not sure I'm posting in the good subreddit, don't hesitate to redirect me!
I've a little problem I'm not able to solve, because I don't understand well enough the problem to know where to search.
I would like to create a noscript that manages a .tex file such as :
- it opens a terminal and launches
- it opens the file with kwrite
Ideally, I declare this noscript as an application that I can set as the default application for
I first tried to create a
Then I added a
Thanks in advance for your help!
https://redd.it/1i8aa47
@r_bash
Hello!
I'm not sure I'm posting in the good subreddit, don't hesitate to redirect me!
I've a little problem I'm not able to solve, because I don't understand well enough the problem to know where to search.
I would like to create a noscript that manages a .tex file such as :
- it opens a terminal and launches
latex -pdf -pvc $FILE, $FILE being the argument file- it opens the file with kwrite
Ideally, I declare this noscript as an application that I can set as the default application for
.tex files. This way, when I double click on the file every of these actions execute themselves.I first tried to create a
latex.sh noscript (yes it's executable) :#!/bin/bash
latexmk -pdf -pvc $1 &
kwrite $1 &
Then I added a
.desktop file in ~/.local/share/applications and tried to open a .tex file with this application. Without surprise it does not work, but I don't really know what exactly is the process I want to see in the system so it's difficult to improve the noscript...Thanks in advance for your help!
https://redd.it/1i8aa47
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Importance of checking IFS
I just wanted to spread a word about importance of explicitly defining and assigning values to IFS.
After years of noscripting in bash in Ubuntu i never thought of non standard IFS values in other linux based operating systems.
Few minutes ago figured out why some of my noscripts weren’t working properly in openwrt. IFS in openwrt contains only /n newline character vs tab space and newline.
Can be checked by looking into environment via set (printenv is not installed by default) or simply by echoing IFS and piping into cat: echo “$IFS” | cat -A
Hope this will save someone down the road from wasting hours on debugging.
My noscripts weren’t working simply copied to openwrt as they were working on Ubuntu and didnt show any issues at first glance. I want to pinpoint here that i didnt write in openwrt environment or else i would have checked IFS. From now on i will make a habit to assign it right after the shebang.
Thanks.
https://redd.it/1i9qz8r
@r_bash
I just wanted to spread a word about importance of explicitly defining and assigning values to IFS.
After years of noscripting in bash in Ubuntu i never thought of non standard IFS values in other linux based operating systems.
Few minutes ago figured out why some of my noscripts weren’t working properly in openwrt. IFS in openwrt contains only /n newline character vs tab space and newline.
Can be checked by looking into environment via set (printenv is not installed by default) or simply by echoing IFS and piping into cat: echo “$IFS” | cat -A
Hope this will save someone down the road from wasting hours on debugging.
My noscripts weren’t working simply copied to openwrt as they were working on Ubuntu and didnt show any issues at first glance. I want to pinpoint here that i didnt write in openwrt environment or else i would have checked IFS. From now on i will make a habit to assign it right after the shebang.
Thanks.
https://redd.it/1i9qz8r
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
HELP!
I'm trying to make a simple OS that uses BASH and coreutils as a base.
I searched and asked to chatgpt how to compile it to a unknown os and basically everything went wrong.
btw, i'm on windows 11 with nasm,gcc, mingw, msys2 and Arch WSL.
Can someone help me?
https://redd.it/1i9qukp
@r_bash
I'm trying to make a simple OS that uses BASH and coreutils as a base.
I searched and asked to chatgpt how to compile it to a unknown os and basically everything went wrong.
btw, i'm on windows 11 with nasm,gcc, mingw, msys2 and Arch WSL.
Can someone help me?
https://redd.it/1i9qukp
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Chatgpt in bash
Hi, first post here so please go easy..... !
I love modifying bash, and have recently thought about having Chatgpt work directly from bash by just typing a simple command whenever needed/wanted. As a result i have created the following, it seems to work fine and have added a menu to it for added functionality.
Feedback would be most welcome please - https://github.com/Fenlanddavid/AI-command/blob/main/gpt.sh
https://redd.it/1ial3l3
@r_bash
Hi, first post here so please go easy..... !
I love modifying bash, and have recently thought about having Chatgpt work directly from bash by just typing a simple command whenever needed/wanted. As a result i have created the following, it seems to work fine and have added a menu to it for added functionality.
Feedback would be most welcome please - https://github.com/Fenlanddavid/AI-command/blob/main/gpt.sh
https://redd.it/1ial3l3
@r_bash
GitHub
AI-command/gpt.sh at main · Fenlanddavid/AI-command
Small command-line AI assistant tool for quick interactions with GPT. - Fenlanddavid/AI-command