noscript fails at first check
when using sudo -i before using ./ to execute the noscript, it fails saying that It could not find any keys despite them being there in /root/.ssh
​
\#!/bin/bash
​
LOCAL_DIR=/mnt/sda
​
\#check if user has elevated priveliges
​
ID=$(whoami)
IDCHECK=$(echo "root")
FIRSTTIMEUSER=$(ls \~/.ssh | grep id)
FIRSTTIMEUSERCHECK=$(ls \~/.ssh)
SSHFIRSTTIME=$(ssh $USER@$ADDRESS)
SSHFIRSTTIMECHECK=$(ssh $USER@$ADSDRESS | grep "Are you sure you want to continue connecting (yes/no)?")
PASSWORDAUTH=$(echo "yes")
touch \~/log.txt
​
\#check that user is superuser
​
if [[ $ID != $IDCHECK \]\]; then
echo "please execute this noscript as superuser to ensure root direcotry is backed up"
exit
elif [[ $FIRSTTIMEUSERCHECK != $FIRSTTIMEUSER \]\]; then
echo "no ssh keys detected, please ensure ssh is set up, noscript will remain inacitve for 1 hour to allow you to check ssh is set up before proceeding"
sleep 3600
fi
​
\#prompt for details
​
echo "ssh user"
read USER
​
echo "ssh password"
read -s PASSWORD
​
echo "ADDRESS"
read -s ADDRESS
​
echo "password authentication (yes/no)"
read PASSWORDAUTHENTICATION
​
\#zipping root directory excluding certain ones
cd $LOCAL_DIR
zip -9 -T -r --exclude=/proc/* --exclude=/sys/* --exclude=/boot/* --exclude=/tmp/* --exclude=/mnt/* --exclude=/media/* --exclude=/dev/* --exclude=/swapfile --exclude=/swap/* --exclude=/run/* --exclude=/Trash/* --exclude=/"lost+found"/* / backup.zip 2> \~/log.txt
​
\#check for password authentication
​
if [[ $PASSWORDAUTHENTICATION = $PASSWORDAUTH \]\]; then <<EOF
ssh $USER@$ADDRESS
$PASSWORD
\#following steps navigate to local directory and remote directory
lcd $LOCAL_DIR
cd adgow
cd "files to encrypt"
put backup.zip
elif [[$PASSWORDAUTHENTICATION != $PASSWORDAUTH \]\]; then
ssh $USER@$ADDRESS
lcd $LOCAL_DIR
cd adgow
cd "files to encrypt"
put backup.zip
fi
​
\#check if first time connection message comes up and answer yes if so
​
if [[ $SSHFIRSTTIME == $SSHFIRSTTIMECHECK \]\]
then
yes
fi
​
EOF
https://redd.it/zoun9y
@r_bash
when using sudo -i before using ./ to execute the noscript, it fails saying that It could not find any keys despite them being there in /root/.ssh
​
\#!/bin/bash
​
LOCAL_DIR=/mnt/sda
​
\#check if user has elevated priveliges
​
ID=$(whoami)
IDCHECK=$(echo "root")
FIRSTTIMEUSER=$(ls \~/.ssh | grep id)
FIRSTTIMEUSERCHECK=$(ls \~/.ssh)
SSHFIRSTTIME=$(ssh $USER@$ADDRESS)
SSHFIRSTTIMECHECK=$(ssh $USER@$ADSDRESS | grep "Are you sure you want to continue connecting (yes/no)?")
PASSWORDAUTH=$(echo "yes")
touch \~/log.txt
​
\#check that user is superuser
​
if [[ $ID != $IDCHECK \]\]; then
echo "please execute this noscript as superuser to ensure root direcotry is backed up"
exit
elif [[ $FIRSTTIMEUSERCHECK != $FIRSTTIMEUSER \]\]; then
echo "no ssh keys detected, please ensure ssh is set up, noscript will remain inacitve for 1 hour to allow you to check ssh is set up before proceeding"
sleep 3600
fi
​
\#prompt for details
​
echo "ssh user"
read USER
​
echo "ssh password"
read -s PASSWORD
​
echo "ADDRESS"
read -s ADDRESS
​
echo "password authentication (yes/no)"
read PASSWORDAUTHENTICATION
​
\#zipping root directory excluding certain ones
cd $LOCAL_DIR
zip -9 -T -r --exclude=/proc/* --exclude=/sys/* --exclude=/boot/* --exclude=/tmp/* --exclude=/mnt/* --exclude=/media/* --exclude=/dev/* --exclude=/swapfile --exclude=/swap/* --exclude=/run/* --exclude=/Trash/* --exclude=/"lost+found"/* / backup.zip 2> \~/log.txt
​
\#check for password authentication
​
if [[ $PASSWORDAUTHENTICATION = $PASSWORDAUTH \]\]; then <<EOF
ssh $USER@$ADDRESS
$PASSWORD
\#following steps navigate to local directory and remote directory
lcd $LOCAL_DIR
cd adgow
cd "files to encrypt"
put backup.zip
elif [[$PASSWORDAUTHENTICATION != $PASSWORDAUTH \]\]; then
ssh $USER@$ADDRESS
lcd $LOCAL_DIR
cd adgow
cd "files to encrypt"
put backup.zip
fi
​
\#check if first time connection message comes up and answer yes if so
​
if [[ $SSHFIRSTTIME == $SSHFIRSTTIMECHECK \]\]
then
yes
fi
​
EOF
https://redd.it/zoun9y
@r_bash
Could you guys share some smartctl output samples for my noscript?
Speaking about https://github.com/slowpeek/hddtemp. It is based on smartctl which uses three different output formats: ata, nvme and scsi. I've got enough SATA disks, but none of NVME nor SCSI to get real smartctl output samples.
I want to add some samples to the public repo. Could you share output of
https://redd.it/zpqmz1
@r_bash
Speaking about https://github.com/slowpeek/hddtemp. It is based on smartctl which uses three different output formats: ata, nvme and scsi. I've got enough SATA disks, but none of NVME nor SCSI to get real smartctl output samples.
I want to add some samples to the public repo. Could you share output of
smartctl -i -A -q noserial for your NVME/SCSI disks?https://redd.it/zpqmz1
@r_bash
GitHub
GitHub - slowpeek/hddtemp: smartctl-based replacement for hddtemp
smartctl-based replacement for hddtemp. Contribute to slowpeek/hddtemp development by creating an account on GitHub.
How to create an alias for a "cat" file usable in a path
Hello everybody,
I have two hughe files (150G each) and I need to use a tool for which I should suuply them as a single file (since the tool only accepts one file). However, I do not really want to merge these files for several reasons, but I cannot pipe them using something like `<(cat file1 file2)` or `myfile=$(cat file1 file2)` because the noscript use the path of the input file for make use of another external tool on it.
So I would need something like:
alias myfile = "cat file1 file2"
such that, using:
tool_x --file /path/myfile
would work.
​
I already tried the aforementioned commands but it didn't work.
Is it possible to achieve something like that?
​
**NB** I asked the same question [here](https://askubuntu.com/questions/1446265/how-to-create-an-alias-for-a-cat-file-usable-in-a-path). I'll let you know if I get some external interesting answer.
https://redd.it/zpqcff
@r_bash
Hello everybody,
I have two hughe files (150G each) and I need to use a tool for which I should suuply them as a single file (since the tool only accepts one file). However, I do not really want to merge these files for several reasons, but I cannot pipe them using something like `<(cat file1 file2)` or `myfile=$(cat file1 file2)` because the noscript use the path of the input file for make use of another external tool on it.
So I would need something like:
alias myfile = "cat file1 file2"
such that, using:
tool_x --file /path/myfile
would work.
​
I already tried the aforementioned commands but it didn't work.
Is it possible to achieve something like that?
​
**NB** I asked the same question [here](https://askubuntu.com/questions/1446265/how-to-create-an-alias-for-a-cat-file-usable-in-a-path). I'll let you know if I get some external interesting answer.
https://redd.it/zpqcff
@r_bash
Ask Ubuntu
How to create an alias for a "cat" file usable in a path
I have two hughe files (150G each) and I need to use a tool for which I should suuply them as a single file (since the tool only accepts one file). However, I do not really want to merge this files...
How to limit download speed of git clone?
How to limit download rate or download speed of git clone?
https://redd.it/zpsn33
@r_bash
How to limit download rate or download speed of git clone?
https://redd.it/zpsn33
@r_bash
reddit
How to limit download speed of git clone?
How to limit download rate or download speed of git clone?
How can I avoid this `-bash: /usr/bin/<functionName>: Argument list too long` error?
I have a file in my $PATH (at, say, `/usr/bin/functionName`) that looks like the following:
#!/bin/bash
functionName() {
#do stuff
}
(( $# > 0 )) && functionName "${@}"
When I pass it (admittedly large) inputs it throws an error:
functionName "$largeInput1" "$largeInput2"
-bash: /usr/bin/<functionName>: Argument list too long
Interestingly, if I source the function first it runs just fine
source "$(which functionName)"
functionName "$largeInput1" "$largeInput2"
<returns expected output>
I know that I could just source the noscript in my `.bashrc` file, but (if possible) Id rather not, since then I have to do that for all my custom functions that might recieve large inputs at some point (so, basically all of them). And, honestly, "putting them in my $PATH and having them just work" seems like a better solution.
Un-wrapping the code from a function *might* work too, but again im not crazy about this.
Best solution I have so far is to add something like this to my .bashrc:
trapfun() { which "${*%% *}" | grep -q -E '^.+$' && source "$(which "${*%% *}")" && "${@}"; }
trap 'trapfun "${BASH_COMMAND}"' ERR
Which works in some simple testing but seems fragile. Id feel a bit better about it with some additional checks before trying to source and re-run the command (e.g., if I could get the trap to fetch the error message text and make sure it contains `-bash: * Argument list too long`, perhaps a check with `file` to ensure that the file returned by `which <functionNAme>` is a sourceable shell noscript, etc.)
Any suggestions?
***
Heres an actual example with code and inputs
#/usr/bin/linecat
#!/bin/bash
linecat () {
(( ${#} < 2 )) && echo "${@}" && return;
local -a A;
local -a B;
mapfile -t B < <(echo "${2}");
mapfile -t A < <(echo "${1}");
(( ${#A[@]} < ${#B[@]} )) && { local -a Aadd; mapfile -t Aadd < <(printf '%0.0s\n' "${B[@]:${#A[@]}}"); A+=("${Aadd[@]}"); }
linecat "$(printf "$(printf '%s %%s\n' "${A[@]}")" "${B[@]}")" "${@:3}"
}
(( $# > 0 )) && linecat "${@}"
# commands
a="$(dd if=/dev/urandom bs=64k count=4|hexdump)"
b="$(dd if=/dev/urandom bs=64k count=5|hexdump)"
linecat "$a" "$b"
# THROWS ERROR
source "$(which linecat)"
linecat "$a" "$b"
# RETURNS CORRECT OUTPUT
https://redd.it/zptkru
@r_bash
I have a file in my $PATH (at, say, `/usr/bin/functionName`) that looks like the following:
#!/bin/bash
functionName() {
#do stuff
}
(( $# > 0 )) && functionName "${@}"
When I pass it (admittedly large) inputs it throws an error:
functionName "$largeInput1" "$largeInput2"
-bash: /usr/bin/<functionName>: Argument list too long
Interestingly, if I source the function first it runs just fine
source "$(which functionName)"
functionName "$largeInput1" "$largeInput2"
<returns expected output>
I know that I could just source the noscript in my `.bashrc` file, but (if possible) Id rather not, since then I have to do that for all my custom functions that might recieve large inputs at some point (so, basically all of them). And, honestly, "putting them in my $PATH and having them just work" seems like a better solution.
Un-wrapping the code from a function *might* work too, but again im not crazy about this.
Best solution I have so far is to add something like this to my .bashrc:
trapfun() { which "${*%% *}" | grep -q -E '^.+$' && source "$(which "${*%% *}")" && "${@}"; }
trap 'trapfun "${BASH_COMMAND}"' ERR
Which works in some simple testing but seems fragile. Id feel a bit better about it with some additional checks before trying to source and re-run the command (e.g., if I could get the trap to fetch the error message text and make sure it contains `-bash: * Argument list too long`, perhaps a check with `file` to ensure that the file returned by `which <functionNAme>` is a sourceable shell noscript, etc.)
Any suggestions?
***
Heres an actual example with code and inputs
#/usr/bin/linecat
#!/bin/bash
linecat () {
(( ${#} < 2 )) && echo "${@}" && return;
local -a A;
local -a B;
mapfile -t B < <(echo "${2}");
mapfile -t A < <(echo "${1}");
(( ${#A[@]} < ${#B[@]} )) && { local -a Aadd; mapfile -t Aadd < <(printf '%0.0s\n' "${B[@]:${#A[@]}}"); A+=("${Aadd[@]}"); }
linecat "$(printf "$(printf '%s %%s\n' "${A[@]}")" "${B[@]}")" "${@:3}"
}
(( $# > 0 )) && linecat "${@}"
# commands
a="$(dd if=/dev/urandom bs=64k count=4|hexdump)"
b="$(dd if=/dev/urandom bs=64k count=5|hexdump)"
linecat "$a" "$b"
# THROWS ERROR
source "$(which linecat)"
linecat "$a" "$b"
# RETURNS CORRECT OUTPUT
https://redd.it/zptkru
@r_bash
reddit
How can I avoid this `-bash: /usr/bin/<functionName>: Argument...
I have a file in my $PATH (at, say, `/usr/bin/functionName`) that looks like the following: #!/bin/bash functionName() { #do...
What can I do if I constantly get memory garbage and all the datas are deleted?
Hi
First of all: Sorry for my lack of programming knowledge and my English as well.
Before I wanted to write down the question I wanted to check how my code works. The point is that its on a remote computer, so I've checked in via ssh username and my password. I've used to cd command to navigate me into a repository where my certain files are.
In this repository there are a .txt file called "surname.txt", where there are different strings and they're from each other with a new line and one code which is called rand1.cpp and reads from the previous .txt file. It looks like this: https://codeshare.io/Rb1Ze3
I've used the g++ complier in order to build the code, and the "./.out" in order to run the program, but it always wrote memory garbage. I've checked my surname.txt file and all the datas have been dissappeared. I remember that was one of those parts of my code which is actually worked... Nevermind. So I've rewrote it. And nothing.
I use nano in order to edit a file. I didn't touch it, I've just checked that all the strings are there. (Yes, they were.) After that I've used the g++ again and checked the .txt second time that all the strings are there. (Yes, they were.) I've run the code and again... Memory garbage. I did this multiple times.
Please help. What have I done wrong?
https://redd.it/zpxda7
@r_bash
Hi
First of all: Sorry for my lack of programming knowledge and my English as well.
Before I wanted to write down the question I wanted to check how my code works. The point is that its on a remote computer, so I've checked in via ssh username and my password. I've used to cd command to navigate me into a repository where my certain files are.
In this repository there are a .txt file called "surname.txt", where there are different strings and they're from each other with a new line and one code which is called rand1.cpp and reads from the previous .txt file. It looks like this: https://codeshare.io/Rb1Ze3
I've used the g++ complier in order to build the code, and the "./.out" in order to run the program, but it always wrote memory garbage. I've checked my surname.txt file and all the datas have been dissappeared. I remember that was one of those parts of my code which is actually worked... Nevermind. So I've rewrote it. And nothing.
I use nano in order to edit a file. I didn't touch it, I've just checked that all the strings are there. (Yes, they were.) After that I've used the g++ again and checked the .txt second time that all the strings are there. (Yes, they were.) I've run the code and again... Memory garbage. I did this multiple times.
Please help. What have I done wrong?
https://redd.it/zpxda7
@r_bash
Rookie question Getting the noscript report.
Hello community!
​
I wonder if there is any possibility to make a statement in the bash noscript which create a report of recent changes in it and for example send a notification via e-mail? Is this even possible to do in bash, without any external plugins?
https://redd.it/zpx29b
@r_bash
Hello community!
​
I wonder if there is any possibility to make a statement in the bash noscript which create a report of recent changes in it and for example send a notification via e-mail? Is this even possible to do in bash, without any external plugins?
https://redd.it/zpx29b
@r_bash
reddit
[Rookie question] Getting the noscript report.
Hello community! I wonder if there is any possibility to make a statement in the bash noscript which create a report of recent changes in...
How to enforce stdout=PIPE in bash without cat?
Sometimes I want to ensure, that stdout is a pipe as this may change the behavior of a program in a wanted way. E.g. more has a nice side effect when it sends output to a pipe instead of a terminal: It adds the file noscript - embedded in lines with colons - to the output. Hence a command like the following is a quick hack to generate an overview in the output:
more /etc/cron.d/* | cat
I‘m just curious: Does anybody knows another - easy to type - method, how to trigger this output mode of more?
https://redd.it/zq1gn4
@r_bash
Sometimes I want to ensure, that stdout is a pipe as this may change the behavior of a program in a wanted way. E.g. more has a nice side effect when it sends output to a pipe instead of a terminal: It adds the file noscript - embedded in lines with colons - to the output. Hence a command like the following is a quick hack to generate an overview in the output:
more /etc/cron.d/* | cat
I‘m just curious: Does anybody knows another - easy to type - method, how to trigger this output mode of more?
https://redd.it/zq1gn4
@r_bash
reddit
How to enforce stdout=PIPE in bash without cat?
Sometimes I want to ensure, that stdout is a pipe as this may change the behavior of a program in a wanted way. E.g. more has a nice side effect...
I have a programming question :)
Hey fellas,
I'm on the quest to kind of automate my semester in terms of checking due dates and such things of that nature. Is there a way that I could grab the due dates that are posted to the website that holds my assignments and stuff? Like, for example:
​
I would like to have a noscript that runs with cron every so often (That part I know how to do) and have it send me a desktop notification saying y'know.. something like "You have a math final due..... blah blah".
I know the wget command does things with websites and HTML and all that good stuff, but is there a way to do what I wanna execute within the command line?
​
Ps: I am doing this strictly for fun :D because I have a newfound love for the linux command line because of its flexibility
so any fun ways to do this, please let me know!
https://redd.it/zq3ugq
@r_bash
Hey fellas,
I'm on the quest to kind of automate my semester in terms of checking due dates and such things of that nature. Is there a way that I could grab the due dates that are posted to the website that holds my assignments and stuff? Like, for example:
​
I would like to have a noscript that runs with cron every so often (That part I know how to do) and have it send me a desktop notification saying y'know.. something like "You have a math final due..... blah blah".
I know the wget command does things with websites and HTML and all that good stuff, but is there a way to do what I wanna execute within the command line?
​
Ps: I am doing this strictly for fun :D because I have a newfound love for the linux command line because of its flexibility
so any fun ways to do this, please let me know!
https://redd.it/zq3ugq
@r_bash
reddit
I have a programming question :)
Hey fellas, I'm on the quest to kind of automate my semester in terms of checking due dates and such things of that nature. Is there a way that I...
pass (password manager) autocompletion for items
I would ask question about pass. Is it a way to autocomplete in the bash in that way do not type parent directory name?
For example structure is
\- directory
\- password1
\- password2
If I want password1 pass I have to type firstly the parent directory name.
Basically I can't type pass TAB and get password1 or password2 suggestions.
For now I'm using noscript providing by pass developers https://git.zx2c4.com/password-store/tree/src/completion/pass.bash-completion
https://redd.it/zq3tim
@r_bash
I would ask question about pass. Is it a way to autocomplete in the bash in that way do not type parent directory name?
For example structure is
\- directory
\- password1
\- password2
If I want password1 pass I have to type firstly the parent directory name.
Basically I can't type pass TAB and get password1 or password2 suggestions.
For now I'm using noscript providing by pass developers https://git.zx2c4.com/password-store/tree/src/completion/pass.bash-completion
https://redd.it/zq3tim
@r_bash
www.passwordstore.org
Pass: The Standard Unix Password Manager
Pass is the standard unix password manager, a lightweight password manager that uses GPG and Git for Linux, BSD, and Mac OS X.
Can anyone help me to create this noscript
​
I need help regarding this, in this we have to create a noscript to do this operation.
https://redd.it/zq1c0e
@r_bash
​
I need help regarding this, in this we have to create a noscript to do this operation.
https://redd.it/zq1c0e
@r_bash
How to do a noscript check with
Hi, I'm trying to figure out a good way to add a check in my noscript with
Currently, When I try a check like this:
But it doesn't work that way. It's not designed very noscripting friendly. It doesn't even output a different ERRORLEVEL if a device is attached or not, it just outputs a string like "List of devices attached\n" then exits.
I already have a feeling piping into
I am actually using dash (Debian shell), so I'd prefer something POSIX sh compliant, but if I have to use bash, that's fine. IDK if there's a Subreddit for POSIX sh noscripting, but would like to know. :)
https://redd.it/zqb2xw
@r_bash
adb devicesHi, I'm trying to figure out a good way to add a check in my noscript with
adb devices to see if any Android device exists before running my noscript further with more adb commands.Currently, When I try a check like this:
if ! adb devices; then
...
exit
fi
But it doesn't work that way. It's not designed very noscripting friendly. It doesn't even output a different ERRORLEVEL if a device is attached or not, it just outputs a string like "List of devices attached\n" then exits.
I already have a feeling piping into
sed is needed here, so then I can test with [ -z $(CMD | sed "blah") ]. but I am TERRIBLE at figuring out the right sed lines to do this. So if anyone can help, that would be great.I am actually using dash (Debian shell), so I'd prefer something POSIX sh compliant, but if I have to use bash, that's fine. IDK if there's a Subreddit for POSIX sh noscripting, but would like to know. :)
https://redd.it/zqb2xw
@r_bash
reddit
How to do a noscript check with `adb devices`
Hi, I'm trying to figure out a good way to add a check in my noscript with `adb devices` to see if any Android device exists before running my...
How do you put the content of a folder inside a tar file?
I tried:
​
tar -cvzf a.tar.gz a
​
and it didn't work. Is there a way to put them inside a tar.gz file without compressing the files? I am not sure what's wrong but my filereader doesn't work when I read the tar.gz file even if the content is the same. I am basically creating a tar.gz file and then extracting the content and then running the bash command with the extracted content to see if my filereader can still read the file, but apparently the files aren't the same and my filereader can't read the created tar, even if it can read the first tar generated through my app.
https://redd.it/zqdhm8
@r_bash
I tried:
​
tar -cvzf a.tar.gz a
​
and it didn't work. Is there a way to put them inside a tar.gz file without compressing the files? I am not sure what's wrong but my filereader doesn't work when I read the tar.gz file even if the content is the same. I am basically creating a tar.gz file and then extracting the content and then running the bash command with the extracted content to see if my filereader can still read the file, but apparently the files aren't the same and my filereader can't read the created tar, even if it can read the first tar generated through my app.
https://redd.it/zqdhm8
@r_bash
reddit
How do you put the content of a folder inside a tar file?
I tried: tar -cvzf a.tar.gz a and it didn't work. Is there a way to put them inside a tar.gz file without compressing the...
Does a Gruvbox theme exist for Bash?
Looking for a gruvbox theme for bash. And maybe konsole, as I use plasma.
https://redd.it/zqimzm
@r_bash
Looking for a gruvbox theme for bash. And maybe konsole, as I use plasma.
https://redd.it/zqimzm
@r_bash
reddit
Does a Gruvbox theme exist for Bash?
Looking for a gruvbox theme for bash. And maybe konsole, as I use plasma.
get user input and add it to an ffmpeg screen recording
I have the following noscript added as aliases in bash
today=`date '+%d_%m_%Y-%H_%M_%S'`;
filename="/tmp/$today.mp4"
alias srec='ffmpeg -f x11grab -video_size 1600x900 -framerate 25 -i $DISPLAY -f alsa -i default -c:v libx264 -preset ultrafast -c:a aac ${filename}'
it records the screen and saves the file to /tmp with todays date.
how can I make it ask for input and it after the date and before the file extension of the video
example:
20-12-2022-{video}.mkv
https://redd.it/zqj63a
@r_bash
I have the following noscript added as aliases in bash
today=`date '+%d_%m_%Y-%H_%M_%S'`;
filename="/tmp/$today.mp4"
alias srec='ffmpeg -f x11grab -video_size 1600x900 -framerate 25 -i $DISPLAY -f alsa -i default -c:v libx264 -preset ultrafast -c:a aac ${filename}'
it records the screen and saves the file to /tmp with todays date.
how can I make it ask for input and it after the date and before the file extension of the video
example:
20-12-2022-{video}.mkv
https://redd.it/zqj63a
@r_bash
reddit
get user input and add it to an ffmpeg screen recording
I have the following noscript added as aliases in bash today=`date '+%d_%m_%Y-%H_%M_%S'`; filename="/tmp/$today.mp4" alias srec='ffmpeg -f x11grab...
curl not finding the file
I made this short noscript
but it's not pushing the screenshot to 0x0 any clue?
https://redd.it/zqk5ax
@r_bash
I made this short noscript
pic_name= "$HOME/Screenshots/$(date +%s).png" maim -s $pic_name url= $(curl -F'file=@$pic_name' https://0x0.st) echo $url | xclip -sel clip dunstify "File Uploaded" "URL: $url \ncopied to clipboard" -t 5000 -i "$HOME/.config/dunst/images/success.png"but it's not pushing the screenshot to 0x0 any clue?
https://redd.it/zqk5ax
@r_bash
reddit
curl not finding the file
I made this short noscript `pic_name= "$HOME/Screenshots/$(date +%s).png"` `maim -s $pic_name` `url= $(curl -F'file=@$pic_name'...
When using echo, both ${pwd} and $pwd work, does it matter which you use?
They both seem to be working. I know the {} is used for arrays but I want to ask whether there is a reason to use one over the other when echoing.
https://redd.it/zr2552
@r_bash
They both seem to be working. I know the {} is used for arrays but I want to ask whether there is a reason to use one over the other when echoing.
https://redd.it/zr2552
@r_bash
reddit
When using echo, both ${pwd} and $pwd work, does it matter which...
They both seem to be working. I know the {} is used for arrays but I want to ask whether there is a reason to use one over the other when echoing.
rgb/hex converter syntax - how does this work?
Hi All.
I'm preparing a wrapper noscript around these snippets I found that convert rgb to hex and hex to rgb. I eventually want to expand it so that it also converts the alpha channel, but I don't quite understand the syntax. Could someone please break down how these following two functions work:
​
hextorgb() {
: "${1/\#/}"
((r = 16#${:0:2}, g = 16#${:2:2}, b = 16#${:4:2}))
printf '%s\n' "rgb($r, $g, $b)"
}
rgbtohex() {
printf '#%02x%02x%02x\n' "$1" "$2" "$3"
}
Any insights into what is happening here, particularly in hex\to_rgb(), would be
greatly appreciated. Thanks in advance.
https://redd.it/zqmvz8
@r_bash
Hi All.
I'm preparing a wrapper noscript around these snippets I found that convert rgb to hex and hex to rgb. I eventually want to expand it so that it also converts the alpha channel, but I don't quite understand the syntax. Could someone please break down how these following two functions work:
​
hextorgb() {
: "${1/\#/}"
((r = 16#${:0:2}, g = 16#${:2:2}, b = 16#${:4:2}))
printf '%s\n' "rgb($r, $g, $b)"
}
rgbtohex() {
printf '#%02x%02x%02x\n' "$1" "$2" "$3"
}
Any insights into what is happening here, particularly in hex\to_rgb(), would be
greatly appreciated. Thanks in advance.
https://redd.it/zqmvz8
@r_bash
reddit
rgb/hex converter syntax - how does this work?
Hi All. I'm preparing a wrapper noscript around these snippets I found that convert rgb to hex and hex to rgb. I eventually want to expand it so...
Guidance with homework
I am a beginner and would like some help with an exercise:
Generate 100 files containing one random number each. Scan the files and find the 5 files that have the highest numbers and the 5 files that have the lowest numbers. Write the numbers you receive in a "list.txt" file.
I have already completed the beginning of generating the files.
I am uncertain of how to sort the 100 files by what's actually written inside each of the files. This is a written example of how I imagined I could do the rest of the exercise, but I don't actually understand how to put it all together:
Would this work? Do I need to use head and tail to find the needed values? Sorry if this isn't enough info.
https://redd.it/zrg7o2
@r_bash
I am a beginner and would like some help with an exercise:
Generate 100 files containing one random number each. Scan the files and find the 5 files that have the highest numbers and the 5 files that have the lowest numbers. Write the numbers you receive in a "list.txt" file.
I have already completed the beginning of generating the files.
for x in $(seq 1 100)doshuf -i 1-1000 -n 1 -o $x.txtdoneI am uncertain of how to sort the 100 files by what's actually written inside each of the files. This is a written example of how I imagined I could do the rest of the exercise, but I don't actually understand how to put it all together:
for x in $(seq 1 5)dofor x in $(seq 1 100)do#find largest number in files out of the directory#find lowest number in files out of the directory#move both of the numbers to list.txt#remove both of the files out of the directory#repeat the process by moving and removing the filesdonedoneWould this work? Do I need to use head and tail to find the needed values? Sorry if this isn't enough info.
https://redd.it/zrg7o2
@r_bash
reddit
Guidance with homework
I am a beginner and would like some help with an exercise: *Generate 100 files containing one random number each. Scan the files and find the 5...
wget --spider fails to check page existence for manned.orgHere is my noscript for automatic page generation. But it even can't check whether man page on manned.org exists: it fails with
HTTP request sent, awaiting response... 403 Forbidden. What should I do?https://redd.it/zrubee
@r_bash
GitHub
generate_page.sh: add noscript for automatic page generation by EmilySeville7cfg · Pull Request #9654 · tldr-pages/tldr
The page(s) are in the correct platform directories: common, linux, osx, windows, sunos, android, etc.
The page(s) have at most 8 examples.
The page denoscription(s) have links to documentation or ...
The page(s) have at most 8 examples.
The page denoscription(s) have links to documentation or ...