What is going on here ?
I need an explanation. Looks like an easter egg, lol !
This is fine:
​
But what is going here ? :
Them the program stops, the mouse cursor changes to a doubled cross until I click on the left mouse button.
The question is : From what hell this cursor came from and why my noscript is blocked until I clicked the left mouse button ?
For sure it is related to the
Of course, adding the interpreter line to the noscript, everything works as expected.
​
PS: I had trouble with inline code,,,,things get messy. I hope formatting it is fixed now.
https://redd.it/ye7435
@r_bash
I need an explanation. Looks like an easter egg, lol !
This is fine:
cat > ~/bin/test.py <<EOF#no interpreter lineprint ("hello world.")EOFchmod +x ~/bin/test.py~/bin/test.py/home/miguel/bin/test.py: line 2: syntax error near unexpected token \"hello world."/home/miguel/bin/test.py: line 2: \print ("hello world.")​
But what is going here ? :
cat > ~/bin/test2.py <<EOF# no interpreter lineimport jsonprint ("hello world.")EOFchmod +x ~/bin/test2.py~/bin/test2.pyThem the program stops, the mouse cursor changes to a doubled cross until I click on the left mouse button.
The question is : From what hell this cursor came from and why my noscript is blocked until I clicked the left mouse button ?
For sure it is related to the
import json, but how , why ?Of course, adding the interpreter line to the noscript, everything works as expected.
​
PS: I had trouble with inline code,,,,things get messy. I hope formatting it is fixed now.
https://redd.it/ye7435
@r_bash
reddit
What is going on here ?
I need an explanation. Looks like an easter egg, lol ! This is fine: `cat > ~/bin/test.py <<EOF` `#no interpreter line` `print ("hello...
Need some help massaging some filenames
Hello all,
I have a large number of music files that needs some TLC.
Here is a sample;
'Polygyny - Absentee Husband (Pt. 1)-mH2vMMl3BDg.mp3'
'Primal Scream - 2013 - Full Length - Official-bdCraT9_wk4.mp3'
'Primal Scream - All Fall Down-4wi2bi9-ZUI.mp3'
'Prince - 1999 (Official Music Video)-rblt2EtFfC4.mp3'
'Pulp - After You (Soulwax Remix)-KTuLLBqs4Xg.mp3'
'Robert Wyatt - Arauco-JPbsBPkIAy0.mp3'
'Robert Wyatt - At Last I Am Free-6xQx4G11pRo.mp3'
'Rufus & Chaka Khan - Ain'\\''t Nobody (Official Video) Remastered Audio HQ-hrWTxRgd4Wk.mp3'
'Saint Etienne - Avenue-h05qHruTmb8.mp3'
"Sandkings - All's Well With The World-rf6-5-9efM8.mp3"
'She Was a Vision-o6YyRX5TIYc.mp3'
'Sisters of Mercy - Alice--GwWra1sQgo.mp3'
'Soul II Soul - Back To Life (However Do You Want Me) (Official Music Video)-TB54dZkzZOY.mp3'
I would like to remove anything inside parenthesis, also at the end of every filename there is that random group of characters between a '-' dash and the '.mp3'.
Now, the parenthesis I could probably finagle a solution to, but the random characters I don't know how to do.
Can some bright young bash wiz help out an old man?
https://redd.it/yeknqt
@r_bash
Hello all,
I have a large number of music files that needs some TLC.
Here is a sample;
'Polygyny - Absentee Husband (Pt. 1)-mH2vMMl3BDg.mp3'
'Primal Scream - 2013 - Full Length - Official-bdCraT9_wk4.mp3'
'Primal Scream - All Fall Down-4wi2bi9-ZUI.mp3'
'Prince - 1999 (Official Music Video)-rblt2EtFfC4.mp3'
'Pulp - After You (Soulwax Remix)-KTuLLBqs4Xg.mp3'
'Robert Wyatt - Arauco-JPbsBPkIAy0.mp3'
'Robert Wyatt - At Last I Am Free-6xQx4G11pRo.mp3'
'Rufus & Chaka Khan - Ain'\\''t Nobody (Official Video) Remastered Audio HQ-hrWTxRgd4Wk.mp3'
'Saint Etienne - Avenue-h05qHruTmb8.mp3'
"Sandkings - All's Well With The World-rf6-5-9efM8.mp3"
'She Was a Vision-o6YyRX5TIYc.mp3'
'Sisters of Mercy - Alice--GwWra1sQgo.mp3'
'Soul II Soul - Back To Life (However Do You Want Me) (Official Music Video)-TB54dZkzZOY.mp3'
I would like to remove anything inside parenthesis, also at the end of every filename there is that random group of characters between a '-' dash and the '.mp3'.
Now, the parenthesis I could probably finagle a solution to, but the random characters I don't know how to do.
Can some bright young bash wiz help out an old man?
https://redd.it/yeknqt
@r_bash
reddit
Need some help massaging some filenames
Hello all, I have a large number of music files that needs some TLC. Here is a sample; 'Polygyny - Absentee Husband (Pt....
Special noscript for get full information about any linux system
Hello everybody!I serve a lot of linux system and when I connect to them I want to get simple information about system: hostname, list last commands, information about memory, hardware and other. I wrote a little noscript and I want go get a good critique. Please look at this noscript and give me some advice how I can make this code better, thank you.
My Script: https://pastebin.com/Pv2VZ44B. You can use this noscript, if you like it
A little denoscription about algorithms this noscript:
Get Info about noscript and weather by ip info :) - `curl, l2.io/ip,` [`wttr.in`](https://wttr.in)
Get General Info -
Get Hardware Info - `sudo lshw`
Get Network Info -
Get Memory Info (>!this code i take on the internet - perhaps stackoverflow.com!<) - `ps`
Get Disk Info -
Get Network Trafic Info - (>!this code i take on the internet - perhaps stackoverflow.com!<) - `proc/net/dev`
Get Logins and History Info -
https://redd.it/yemqeo
@r_bash
Hello everybody!I serve a lot of linux system and when I connect to them I want to get simple information about system: hostname, list last commands, information about memory, hardware and other. I wrote a little noscript and I want go get a good critique. Please look at this noscript and give me some advice how I can make this code better, thank you.
My Script: https://pastebin.com/Pv2VZ44B. You can use this noscript, if you like it
A little denoscription about algorithms this noscript:
Get Info about noscript and weather by ip info :) - `curl, l2.io/ip,` [`wttr.in`](https://wttr.in)
Get General Info -
uname, lsb_release, whoami, whoGet Hardware Info - `sudo lshw`
Get Network Info -
ip add showGet Memory Info (>!this code i take on the internet - perhaps stackoverflow.com!<) - `ps`
Get Disk Info -
dfGet Network Trafic Info - (>!this code i take on the internet - perhaps stackoverflow.com!<) - `proc/net/dev`
Get Logins and History Info -
last, lastb, /etc/paswd, historyhttps://redd.it/yemqeo
@r_bash
Bash readline command not recognized
Hey there,
I am currently customizing my inputrc to set new keybindings for the set -o vi mode.
[readline library\]
There is a command list in man(1) bash.
```
previous-screen-line
Attempt to move point to the same physical screen column on the previous physical screen line. This will not have the desired effect if the current readline line does not take up more than one physical line or if point is not greater than the length of the prompt plus the screen width.
next-screen-line
Attempt to move point to the same physical screen column on the next physical screen line. This will not have the desired effect if the current readline line does not take up more than one physical line or if the length of current readline line is not greater than the length of the prompt plus the screen width.
```
All the other commands work as expected. Yet those two do not.
Any1 has any idea why ?
Thanks for your time :)
https://redd.it/yep02s
@r_bash
Hey there,
I am currently customizing my inputrc to set new keybindings for the set -o vi mode.
[readline library\]
There is a command list in man(1) bash.
```
previous-screen-line
Attempt to move point to the same physical screen column on the previous physical screen line. This will not have the desired effect if the current readline line does not take up more than one physical line or if point is not greater than the length of the prompt plus the screen width.
next-screen-line
Attempt to move point to the same physical screen column on the next physical screen line. This will not have the desired effect if the current readline line does not take up more than one physical line or if the length of current readline line is not greater than the length of the prompt plus the screen width.
```
All the other commands work as expected. Yet those two do not.
Any1 has any idea why ?
Thanks for your time :)
https://redd.it/yep02s
@r_bash
reddit
Bash readline command not recognized
Hey there, I am currently customizing my inputrc to set new keybindings for the set -o vi mode. \[readline library\] There is a command list in...
getopts switches
Created a noscript which is using getopts,and has 4 switches -> 3,p,d and h. How could I limit the usage to something like:
- if h is used, no other switch should be used
- switch 3 and p should not be used together
I would like to know if there's way of accomplishing this without using tests outside the while loop.
Thanks
https://redd.it/yetohi
@r_bash
Created a noscript which is using getopts,and has 4 switches -> 3,p,d and h. How could I limit the usage to something like:
- if h is used, no other switch should be used
- switch 3 and p should not be used together
I would like to know if there's way of accomplishing this without using tests outside the while loop.
Thanks
https://redd.it/yetohi
@r_bash
reddit
getopts switches
Created a noscript which is using getopts,and has 4 switches -> 3,p,d and h. How could I limit the usage to something like: - if h is used, no...
Security: Prevent Override of Bash Builtins?
Greetings Bash Hackers,
I have been using Bash daily for several years as both a noscripting/glue language, and as a more general-purpose programming language. Something that has bothered me for a long time is Bash's lack of reserved words. Before you continue reading, you'll want to put your tin foil hat on.
In some other languages, there is a relatively large set of builtin functions that cannot be overridden for security reasons. Bash, on the other hand, has relatively few of these (i.e. time, if, function, et cetera), and some of the things that you'd expect to be reserved (i.e. builtin, declare, readonly, et cetera), are not. Maybe I'm wrong, but to me: this seems like an oversight and a pretty big security hole. I can see the utility of being able to mock out some of these builtins temporarily for unit testing purposes, but not being able to toggle that behavior seems like a huge issue. Someone with malicious intent, for example, could try to inject function definitions in the environment inherited by the noscript, or could use improperly sanitized noscript parameters to define malicious functions of the same name as builtins.
Going through Bash's info page, there is a "restricted mode" that prevents shell builtins from being overridden with functions of the same name, but that also toggles off quite a few other nice bash features that most people would want to keep in place, even if they toggled off the ability to override builtins. Not all, but many of these features disabled by restricted mode, don't appear to have major security issues that would warrant disabling them; or the security issues are easy to mitigate with decent input sanitization or similar security practices.
So, I have a few questions:
Is it unreasonable to expect Bash users to be able to toggle off features in a piecemeal fashion, instead of the all-or-none approach that restricted mode provides? Are all of the features that it toggles off equally dangerous and as difficult to mitigate?
If this is not an unreasonable goal, is there a way to toggle off just the ability to override builtins that I have just not been able to figure out yet?
To better illustrate this issue, here is an example of something I have considered that doesn't quite work. Since 'function' is a reserved word, I have used that to create a function that wraps builtins, like so:
function readonly() { builtin readonly $@; }
This would work great, if someone hasn't already overridden the 'builtin' builtin. You could 'unset' any potentially set/inherited builtin functions prior to invoking them, (including the 'builtin' builtin), but 'unset' could have been overridden as well. You could exclude the use of the 'builtin' builtin inside of the function definition above, but then its just a function that calls itself over-and-over again. You could make sure that any function you set in the way illustrated above is readonly, using the 'readonly' or 'declare' builtin, but you still have the same chicken-and-egg problem. The 'readonly' and 'declare' builtins could easily be overridden with a function the noscript maliciously (or accidentally) inherits from the environment, making it untrusted as well.
Based on the experiment above, I don't see a way to prevent the overriding of builtins using just the reserved words Bash has available. I also have not found a shell option (shopt) or bash flag that can be passed when invoking Bash that lets you prevent builtin overrides, without also toggling off a bunch of other useful features. Is there another version of the bash '-r' (aka restricted mode) flag that only toggles off the ability to override builtins? Is there some other, completely different, way to do this that I have not considered? Am I crazy for even wanting to do this?
https://redd.it/yeucrq
@r_bash
Greetings Bash Hackers,
I have been using Bash daily for several years as both a noscripting/glue language, and as a more general-purpose programming language. Something that has bothered me for a long time is Bash's lack of reserved words. Before you continue reading, you'll want to put your tin foil hat on.
In some other languages, there is a relatively large set of builtin functions that cannot be overridden for security reasons. Bash, on the other hand, has relatively few of these (i.e. time, if, function, et cetera), and some of the things that you'd expect to be reserved (i.e. builtin, declare, readonly, et cetera), are not. Maybe I'm wrong, but to me: this seems like an oversight and a pretty big security hole. I can see the utility of being able to mock out some of these builtins temporarily for unit testing purposes, but not being able to toggle that behavior seems like a huge issue. Someone with malicious intent, for example, could try to inject function definitions in the environment inherited by the noscript, or could use improperly sanitized noscript parameters to define malicious functions of the same name as builtins.
Going through Bash's info page, there is a "restricted mode" that prevents shell builtins from being overridden with functions of the same name, but that also toggles off quite a few other nice bash features that most people would want to keep in place, even if they toggled off the ability to override builtins. Not all, but many of these features disabled by restricted mode, don't appear to have major security issues that would warrant disabling them; or the security issues are easy to mitigate with decent input sanitization or similar security practices.
So, I have a few questions:
Is it unreasonable to expect Bash users to be able to toggle off features in a piecemeal fashion, instead of the all-or-none approach that restricted mode provides? Are all of the features that it toggles off equally dangerous and as difficult to mitigate?
If this is not an unreasonable goal, is there a way to toggle off just the ability to override builtins that I have just not been able to figure out yet?
To better illustrate this issue, here is an example of something I have considered that doesn't quite work. Since 'function' is a reserved word, I have used that to create a function that wraps builtins, like so:
function readonly() { builtin readonly $@; }
This would work great, if someone hasn't already overridden the 'builtin' builtin. You could 'unset' any potentially set/inherited builtin functions prior to invoking them, (including the 'builtin' builtin), but 'unset' could have been overridden as well. You could exclude the use of the 'builtin' builtin inside of the function definition above, but then its just a function that calls itself over-and-over again. You could make sure that any function you set in the way illustrated above is readonly, using the 'readonly' or 'declare' builtin, but you still have the same chicken-and-egg problem. The 'readonly' and 'declare' builtins could easily be overridden with a function the noscript maliciously (or accidentally) inherits from the environment, making it untrusted as well.
Based on the experiment above, I don't see a way to prevent the overriding of builtins using just the reserved words Bash has available. I also have not found a shell option (shopt) or bash flag that can be passed when invoking Bash that lets you prevent builtin overrides, without also toggling off a bunch of other useful features. Is there another version of the bash '-r' (aka restricted mode) flag that only toggles off the ability to override builtins? Is there some other, completely different, way to do this that I have not considered? Am I crazy for even wanting to do this?
https://redd.it/yeucrq
@r_bash
reddit
Security: Prevent Override of Bash Builtins?
Greetings Bash Hackers, I have been using Bash daily for several years as both a noscripting/glue language, and as a more general-purpose...
How to escape single quotes?
I know this question has been asked many times already, however none of the answers have worked for me. I am trying to escape single quotes so I can use variables in this shell noscript. The noscript recognizes specific links from a text file, then sends a command that replaces a specific string in a different file with a image link. It works fine, however not when I try to add a variable. It just says "No such file or directory" whenever executed.
#!/bin/bash
bash -c 'examplelink.com() { sed -i -e "/e_embed.set_thumbnail(url/s/\".*\"/\"exampleimagelink.com\"/" '$1'/cogs/Embeds.py; }; cd '$var'/'$2'; . ./file.txt';
var="/to/folder";
I have tried several things.
'"'"'$var'"'"'
"'$var'"
\'$var'\''
As well as other stuff including different combinations of the shown examples.
https://redd.it/yewd51
@r_bash
I know this question has been asked many times already, however none of the answers have worked for me. I am trying to escape single quotes so I can use variables in this shell noscript. The noscript recognizes specific links from a text file, then sends a command that replaces a specific string in a different file with a image link. It works fine, however not when I try to add a variable. It just says "No such file or directory" whenever executed.
#!/bin/bash
bash -c 'examplelink.com() { sed -i -e "/e_embed.set_thumbnail(url/s/\".*\"/\"exampleimagelink.com\"/" '$1'/cogs/Embeds.py; }; cd '$var'/'$2'; . ./file.txt';
var="/to/folder";
I have tried several things.
'"'"'$var'"'"'
"'$var'"
\'$var'\''
As well as other stuff including different combinations of the shown examples.
https://redd.it/yewd51
@r_bash
reddit
How to escape single quotes?
I know this question has been asked many times already, however none of the answers have worked for me. I am trying to escape single quotes so I...
Shell expansion question
I'm trying to noscript the publishing and promotion of content-views in RH Satellite (The Foreman), and the versions aren't always equal, so I need to have dynamically named variables, like repo1\_ver, repo2\_ver, etc. The versions evaluate to 1.0, or 5.0, or whatever, always in an x.y format.
​
Here's a simplified version of what I'm doing
CV_LIST=(test0 test1 test2 test_space)
get_version() {
echo -e "===============\nWhat this does\n==============="
for CV in "${CV_LIST[@]}" ; do
declare -g ${CV}_VER=$(hammer --csv --no-headers content-view version list --content-view $CV | sed -n '1'p | awk -F, '{ print $3 }')
echo "${CV}_VER"
done
echo -e "\n\n===============\nWhat I want this to do\n==============="
echo $test0_VER
echo $test1_VER
echo $test2_VER
echo $test_space_VER
}
get_version
The output is
===============
What this does
===============
test0_VER
test1_VER
test2_VER
test_space_VER
===============
What I want this to do
===============
1.0
1.0
1.0
2.0
I want it to do that because I want to take the output of ${CV}\_VER and use it in the next hammer command to promote the content views to the next version in another loop, like
​
for ENV in Dev QA Mgmt PreProd Prod ; do hammer content-view version promote --content-view $CV --to-lifecycle-environment $ENV --version ${CV}_VER ; done
I know I could create another array and do like this
NEWVERS=(${test0_VER} ${test1_VER} ${test2_VER} ${test_space_VER})
for CV in "${CV_LIST[@]}" ; do
for VER in "${NEWVERS[@]}" ; do
for ENV in Dev QA Mgmt PreProd Prod ; do hammer content-view version promote --content-view $CV --to-lifecycle-environment $ENV --version $VER ; done
done
done
In fact, that's what I did. I just want to know if what I would prefer to do is possible, or if I'm trying to do something that can't be done.
https://redd.it/yf9kbp
@r_bash
I'm trying to noscript the publishing and promotion of content-views in RH Satellite (The Foreman), and the versions aren't always equal, so I need to have dynamically named variables, like repo1\_ver, repo2\_ver, etc. The versions evaluate to 1.0, or 5.0, or whatever, always in an x.y format.
​
Here's a simplified version of what I'm doing
CV_LIST=(test0 test1 test2 test_space)
get_version() {
echo -e "===============\nWhat this does\n==============="
for CV in "${CV_LIST[@]}" ; do
declare -g ${CV}_VER=$(hammer --csv --no-headers content-view version list --content-view $CV | sed -n '1'p | awk -F, '{ print $3 }')
echo "${CV}_VER"
done
echo -e "\n\n===============\nWhat I want this to do\n==============="
echo $test0_VER
echo $test1_VER
echo $test2_VER
echo $test_space_VER
}
get_version
The output is
===============
What this does
===============
test0_VER
test1_VER
test2_VER
test_space_VER
===============
What I want this to do
===============
1.0
1.0
1.0
2.0
I want it to do that because I want to take the output of ${CV}\_VER and use it in the next hammer command to promote the content views to the next version in another loop, like
​
for ENV in Dev QA Mgmt PreProd Prod ; do hammer content-view version promote --content-view $CV --to-lifecycle-environment $ENV --version ${CV}_VER ; done
I know I could create another array and do like this
NEWVERS=(${test0_VER} ${test1_VER} ${test2_VER} ${test_space_VER})
for CV in "${CV_LIST[@]}" ; do
for VER in "${NEWVERS[@]}" ; do
for ENV in Dev QA Mgmt PreProd Prod ; do hammer content-view version promote --content-view $CV --to-lifecycle-environment $ENV --version $VER ; done
done
done
In fact, that's what I did. I just want to know if what I would prefer to do is possible, or if I'm trying to do something that can't be done.
https://redd.it/yf9kbp
@r_bash
reddit
Shell expansion question
I'm trying to noscript the publishing and promotion of content-views in RH Satellite (The Foreman), and the versions aren't always equal, so I need...
Help reading a file that consists of single lines of commands, and then running those commands.
My aim is a noscript that reads lines of commands from a file, execute each line and then add the exit code from each to an array. Some lines have multiple commands. Forgive my mobile formatting, or lack thereof. My noscript is something like:
arr=()
while IFS= read -r line
do
#execute line
"${line}"
#add exit code from command to array
arr+=($?)
done < config.txt
And config.txt has commands like:
! -z $variable
crontab -l | grep -q "dothething.txt"
-d "/some/folder/path"
$inferesting_info > file.txt; #do some other things here; And one more thing here
...
My problem is, the commands are not being executed properly, and I'm thinking there's got to be a way to encapsulate each line of command(s) to have it parse correctly and then unwrap it to run iI: with a combination of parenthesis or quotations, or something. I just can't figure it out. Any help is greatly appreciated!
[https://redd.it/yfbnln
@r_bash
My aim is a noscript that reads lines of commands from a file, execute each line and then add the exit code from each to an array. Some lines have multiple commands. Forgive my mobile formatting, or lack thereof. My noscript is something like:
arr=()
while IFS= read -r line
do
#execute line
"${line}"
#add exit code from command to array
arr+=($?)
done < config.txt
And config.txt has commands like:
! -z $variable
crontab -l | grep -q "dothething.txt"
-d "/some/folder/path"
$inferesting_info > file.txt; #do some other things here; And one more thing here
...
My problem is, the commands are not being executed properly, and I'm thinking there's got to be a way to encapsulate each line of command(s) to have it parse correctly and then unwrap it to run iI: with a combination of parenthesis or quotations, or something. I just can't figure it out. Any help is greatly appreciated!
[https://redd.it/yfbnln
@r_bash
reddit
Help reading a file that consists of single lines of commands, and...
My aim is a noscript that reads lines of commands from a file, execute each line and then add the exit code from each to an array. Some lines have...
Part of my noscript is not working i need some help
am trying to automate image creation, am a total noob still, i know my code is probably an abomination too lol, anyway am trying to move 3 images from the source folder then apply some image processing then add the 3 images into one thumbnail and outputting it, everything worked just fined but the part that has " `# this part is not working i dont know why` " before maeking the code specify directories it was working, i appreciate the help :DD
​
am here in the terminal trying to use the 3 directories in the noscript
~/coding/Fullnoscript$ ls
out processing sources 'test (copy).sh' test.sh
​
#!/bin/bash
imgsu=sources
target=processing
outfold=out
i=0
ls -Q $imgsu/ | head -3 | xargs -i mv $imgsu/{} $target/
echo "Initiating"
for file in $target/* ; do
if [ -e "$file" ] ; then
mv "$file" $target/fileinput_$i.png
i=$((i+1))
fi
done
echo "Naming Finished!"
for file in $target/* ; do # this part is not working i dont know why
if [ -e "$file" ] ; then
convert $target/$file -resize 910x910 -fuzz 1% -trim +repage $target/$file
fi
done
echo "Resize Finished!"
convert -size 1920x1080 canvas:black \
-gravity southwest $target/fileinput_1.png -geometry +40+10 -composite \
-gravity southeast $target/fileinput_2.png -geometry +40+10 -composite \
-gravity north $target/fileinput_0.png -geometry +0+10 -composite \
$outfold/out.png
https://redd.it/yfmasz
@r_bash
am trying to automate image creation, am a total noob still, i know my code is probably an abomination too lol, anyway am trying to move 3 images from the source folder then apply some image processing then add the 3 images into one thumbnail and outputting it, everything worked just fined but the part that has " `# this part is not working i dont know why` " before maeking the code specify directories it was working, i appreciate the help :DD
​
am here in the terminal trying to use the 3 directories in the noscript
~/coding/Fullnoscript$ ls
out processing sources 'test (copy).sh' test.sh
​
#!/bin/bash
imgsu=sources
target=processing
outfold=out
i=0
ls -Q $imgsu/ | head -3 | xargs -i mv $imgsu/{} $target/
echo "Initiating"
for file in $target/* ; do
if [ -e "$file" ] ; then
mv "$file" $target/fileinput_$i.png
i=$((i+1))
fi
done
echo "Naming Finished!"
for file in $target/* ; do # this part is not working i dont know why
if [ -e "$file" ] ; then
convert $target/$file -resize 910x910 -fuzz 1% -trim +repage $target/$file
fi
done
echo "Resize Finished!"
convert -size 1920x1080 canvas:black \
-gravity southwest $target/fileinput_1.png -geometry +40+10 -composite \
-gravity southeast $target/fileinput_2.png -geometry +40+10 -composite \
-gravity north $target/fileinput_0.png -geometry +0+10 -composite \
$outfold/out.png
https://redd.it/yfmasz
@r_bash
reddit
Part of my noscript is not working i need some help
am trying to automate image creation, am a total noob still, i know my code is probably an abomination too lol, anyway am trying to move 3 images...
Using python within readarray
I'm having issues trying to use python within readarray.. the error I get is "unexpected EOF while looking for matching ')'. This happens to be the first line of readarray. Any advice?
readarray -t ARR < <(python3 - <<-EOF
import os, itertools
....
....
EOF
)
https://redd.it/yfr3ts
@r_bash
I'm having issues trying to use python within readarray.. the error I get is "unexpected EOF while looking for matching ')'. This happens to be the first line of readarray. Any advice?
readarray -t ARR < <(python3 - <<-EOF
import os, itertools
....
....
EOF
)
https://redd.it/yfr3ts
@r_bash
reddit
Using python within readarray
I'm having issues trying to use python within readarray.. the error I get is "unexpected EOF while looking for matching ')'. This happens to be...
Isolate first colum of output ?
Hi all,
​
I'm currently writin a noscript to enable vpn connections on certain conditions on Ubuntu 20.04 machines exclusively, and to do so i need to get the exact name of the VPN connection.
​
I use this command to grep all the vpn connection of the machine :
nmcli con | grep vpn
And the output looks like that :
VPN-Name xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx vpn --
​
​
What i would like is to get only the name in a text file.
I tried to use the awk command like so :
nmcli con | grep vpn | awk '{ print $1, $NF }'
But if the VPN name is two words then it gets only the first word :
For a VPN called "VPN Company Name" it will output "VPN" only.
​
What i want is get the full name of the VPN but i couldn't find any option that could isolate names with the nmcli connection command.
https://redd.it/yfkb40
@r_bash
Hi all,
​
I'm currently writin a noscript to enable vpn connections on certain conditions on Ubuntu 20.04 machines exclusively, and to do so i need to get the exact name of the VPN connection.
​
I use this command to grep all the vpn connection of the machine :
nmcli con | grep vpn
And the output looks like that :
VPN-Name xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx vpn --
​
​
What i would like is to get only the name in a text file.
I tried to use the awk command like so :
nmcli con | grep vpn | awk '{ print $1, $NF }'
But if the VPN name is two words then it gets only the first word :
For a VPN called "VPN Company Name" it will output "VPN" only.
​
What i want is get the full name of the VPN but i couldn't find any option that could isolate names with the nmcli connection command.
https://redd.it/yfkb40
@r_bash
reddit
Isolate first colum of output ?
Hi all, I'm currently writin a noscript to enable vpn connections on certain conditions on Ubuntu 20.04 machines exclusively, and to do...
I created a noscript combining a few ssh commands
Hi everyone,
I combined my frequently used ssh, scp and sshfs commands into a simple noscript.
Github
Feel free to criticize
https://redd.it/yg0diu
@r_bash
Hi everyone,
I combined my frequently used ssh, scp and sshfs commands into a simple noscript.
Github
Feel free to criticize
https://redd.it/yg0diu
@r_bash
GitHub
GitHub - gooosz/syncat
Contribute to gooosz/syncat development by creating an account on GitHub.
Is it possible to iterate through array elements without using FOR or WHILE?
I wonder WHY:
Thanks!
https://redd.it/yg1t1k
@r_bash
I wonder WHY:
printf 'Each element: %s\n' "${foo[@]}" will print each element of the array foo[@] but I still need to loop through the same array with for i in "${foo[@]}"? Is this because of printf()'s built-in logic? E.g.: sudo apt install "${foo[@]}" would be nice but it doesn't work for me.Thanks!
https://redd.it/yg1t1k
@r_bash
reddit
Is it possible to iterate through array elements without using FOR...
I wonder WHY: `printf 'Each element: %s\n' "${foo[@]}"` will print each element of the array `foo[@]` but I still need to loop through the same...
dd from image to SD card: "short write on character device"
Hi,
I'm using MACOS but I think the OS is not the problem here.I tried to backup my 64GB SD card using DD, with:
That goes well. I put in another SD card (same size) and try to restore that same image with:
However, it fails and I then get the error
When I try to restore the image to SD card using the desktop (Disk Utility.app) it fails.
Another thing I tried is to mount both the .dmg image as wel as the new SD card and just copy the content from the image to the SD card, but then I get the error destination is full!
I've tried several SD cards, the image is fine, I can mount it and browse succesfully/any thoughts what can be the issue?
Another thing I was thinking of is the blocksize in the command (1M in my case), but then, I used the same blocksize for writing as reading, so I guess that cannot be the problem.
PLEASE HELP, I tried everything and I'm desperate howto get my SD card cloned.
https://redd.it/yg0sqt
@r_bash
Hi,
I'm using MACOS but I think the OS is not the problem here.I tried to backup my 64GB SD card using DD, with:
sudo dd if=/dev/rdisk2 of=Miyoo64Gb.dmg status=progress bs=16MThat goes well. I put in another SD card (same size) and try to restore that same image with:
sudo dd if=Miyoo64Gb.dmg of=/dev/rdisk2 status=progress bs=1mHowever, it fails and I then get the error
"short write on character device"When I try to restore the image to SD card using the desktop (Disk Utility.app) it fails.
Another thing I tried is to mount both the .dmg image as wel as the new SD card and just copy the content from the image to the SD card, but then I get the error destination is full!
I've tried several SD cards, the image is fine, I can mount it and browse succesfully/any thoughts what can be the issue?
Another thing I was thinking of is the blocksize in the command (1M in my case), but then, I used the same blocksize for writing as reading, so I guess that cannot be the problem.
PLEASE HELP, I tried everything and I'm desperate howto get my SD card cloned.
https://redd.it/yg0sqt
@r_bash
Using output of one curl request in the next noscript
Hey guys, sorry if this has been asked here before, but I couldn’t find anything specific to my scenario and I don’t use bash that much.
I use a curl post request to get an address from an api, that I’m currently copy pasting as the location for the noscript I use next. The issue is the first noscript outputs other stuff too like status codes, upload speeds etc and I just need the url and without the quotation marks and then use it for the second noscript, what’s the simplest way to go about this in a bash file?
https://redd.it/yg7qcl
@r_bash
Hey guys, sorry if this has been asked here before, but I couldn’t find anything specific to my scenario and I don’t use bash that much.
I use a curl post request to get an address from an api, that I’m currently copy pasting as the location for the noscript I use next. The issue is the first noscript outputs other stuff too like status codes, upload speeds etc and I just need the url and without the quotation marks and then use it for the second noscript, what’s the simplest way to go about this in a bash file?
https://redd.it/yg7qcl
@r_bash
reddit
Using output of one curl request in the next noscript
Hey guys, sorry if this has been asked here before, but I couldn’t find anything specific to my scenario and I don’t use bash that much. I use a...
How to determine what block device is mapped to /dev/mapper/
I have an external drive mapped to /dev/mapper/backup.
My question is how do I verify what block device said mapping is mapped to?
My backup drive appears as /dev/sda, what would the command/noscript look like in order to verify that /dev/mapper/backup is in fact /dev/sda?
My god the amount of research I've done trying to figure how to do this is insane. Please send help, thank you
https://redd.it/yg91x4
@r_bash
I have an external drive mapped to /dev/mapper/backup.
My question is how do I verify what block device said mapping is mapped to?
My backup drive appears as /dev/sda, what would the command/noscript look like in order to verify that /dev/mapper/backup is in fact /dev/sda?
My god the amount of research I've done trying to figure how to do this is insane. Please send help, thank you
https://redd.it/yg91x4
@r_bash
reddit
How to determine what block device is mapped to /dev/mapper/
I have an external drive mapped to /dev/mapper/backup. My question is how do I verify what block device said mapping is mapped to? My backup...
How to test for connections excluding ping's
Hi
i am trying to run a minecraft(game) server, and make it start the server when someone tries to connect.
so, i tried using
so, my question is, how to test for a connection that is not ping (or test if a connection is ping, to ignore it.)
https://redd.it/yh6wd3
@r_bash
Hi
i am trying to run a minecraft(game) server, and make it start the server when someone tries to connect.
so, i tried using
netcat -l 25565 and it work when i tried to connect, but that also accepted a ping connection and exited.so, my question is, how to test for a connection that is not ping (or test if a connection is ping, to ignore it.)
https://redd.it/yh6wd3
@r_bash
reddit
How to test for connections excluding ping's
Hi i am trying to run a minecraft(game) server, and make it start the server when someone tries to connect. so, i tried using `netcat -l 25565`...
if something > do something
hey so I have this noscript here and I was wondering about the reposonse from git pull "Already up to date."... Is there anyway I can just continue (break) if git pull returns "Already up to date." and if not continue to pull the next repo? like automate those two pulls so I dont have to press y or n to confirm to continue? Thanks alot!
​
#!/bin/bash
cd ~/github/ares; git pull
while true; do
read -p "##### ares-update? ##### " yn
case $yn in
yes ) ares-update; break;;
[Nn] ) break;;
) echo "Please answer yes or no.";;
esac
done
cd ~/github/dhewm3; git pull
while true; do
read -p "##### dhewm3-update? ##### " yn
case $yn in
[Yy] ) dhewm3-update; break;;
Nn ) break;;
) echo "Please answer yes or no.";;
esac
done
​
https://redd.it/yhbvcv
@r_bash
hey so I have this noscript here and I was wondering about the reposonse from git pull "Already up to date."... Is there anyway I can just continue (break) if git pull returns "Already up to date." and if not continue to pull the next repo? like automate those two pulls so I dont have to press y or n to confirm to continue? Thanks alot!
​
#!/bin/bash
cd ~/github/ares; git pull
while true; do
read -p "##### ares-update? ##### " yn
case $yn in
yes ) ares-update; break;;
[Nn] ) break;;
) echo "Please answer yes or no.";;
esac
done
cd ~/github/dhewm3; git pull
while true; do
read -p "##### dhewm3-update? ##### " yn
case $yn in
[Yy] ) dhewm3-update; break;;
Nn ) break;;
) echo "Please answer yes or no.";;
esac
done
​
https://redd.it/yhbvcv
@r_bash
reddit
if something > do something
hey so I have this noscript here and I was wondering about the reposonse from git pull "Already up to date."... Is there anyway I can just continue...
Standard place to define PATH and other environment variables
I've noticed that almost every installation noscript that adds something to PATH, and almost every guide that instructs the reader to define environment variables, chooses
I can see the value of keeping non-interactive SSH commands quick by not loading more than is necessary, but I would think there would be a noscript where you could define things that you always want, like custom PATH additions. I haven't found a standard solution for this, and it's often annoying and surprising when my commands don't work because PATH isn't getting populated like I thought it would.
Am I missing something? How do you solve this problem?
https://redd.it/yhlriw
@r_bash
I've noticed that almost every installation noscript that adds something to PATH, and almost every guide that instructs the reader to define environment variables, chooses
.bashrc for that. But if you want to be able to run commands over SSH non-interactively which depend on those modifications, .bashrc has no effect. In fact, at least on Ubuntu, .bashrc comes with code at the top to prevent you from sourcing it even explicitly in a non-interactive shell.I can see the value of keeping non-interactive SSH commands quick by not loading more than is necessary, but I would think there would be a noscript where you could define things that you always want, like custom PATH additions. I haven't found a standard solution for this, and it's often annoying and surprising when my commands don't work because PATH isn't getting populated like I thought it would.
Am I missing something? How do you solve this problem?
https://redd.it/yhlriw
@r_bash
reddit
Standard place to define PATH and other environment variables
I've noticed that almost every installation noscript that adds something to PATH, and almost every guide that instructs the reader to define...
Workspace ONE Delivers the MacOS Updater Utility (MUU): Does it Finally Solve the Patching Woes of WS1 Mac Software Updates?
https://mobile-jon.com/2022/10/31/workspace-one-delivers-the-macos-updater-utility-does-it-finally-solve-the-patching-woes-of-ws1-mac-software-updates/
https://redd.it/yi0gv5
@r_bash
https://mobile-jon.com/2022/10/31/workspace-one-delivers-the-macos-updater-utility-does-it-finally-solve-the-patching-woes-of-ws1-mac-software-updates/
https://redd.it/yi0gv5
@r_bash
Mobile-Jon
Workspace ONE Delivers the MacOS Updater Utility (MUU): Does it Finally Solve the Patching Woes of WS1 Mac Software Updates?
Historically, I'm proud to say I have been one of the primary thought-leaders when it comes to MacOS management on Workspace ONE. As evident, from ...