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 ...
How can I get simple output from cURL download progress data?
I'm trying to "marry" `cURL` with `grep`|`awk`|`sed` to extract from the cURL output the real-time download percentage without using extra tools like `pv` and without showing the progress bar.
Preferred format: **Installing file... 55%** ### incrementing on the same position.
This is what I've tried so far after some research:
curl -L --output-dir ${apps_dir} "${url}" -o "${file_name}" 2>&1 | awk 'FNR == 2 '{print $1}' ### fails to show any data
Then I tried this:
curl -# -L --output-dir ${apps_dir} "${url}" -o "${file_name}" 2>&1 | stdbuf -o L tr '\r' '\n' | stdbuf -o L grep -Eo '[0-9.]*%'
The problem with the last line of code (note `-#`) is that it shows what I want but:
* prints out data on new line
* I don't know how to put the printout next to the string "Installing file..." (shame on me!)
Thank you!
https://redd.it/yi8sou
@r_bash
I'm trying to "marry" `cURL` with `grep`|`awk`|`sed` to extract from the cURL output the real-time download percentage without using extra tools like `pv` and without showing the progress bar.
Preferred format: **Installing file... 55%** ### incrementing on the same position.
This is what I've tried so far after some research:
curl -L --output-dir ${apps_dir} "${url}" -o "${file_name}" 2>&1 | awk 'FNR == 2 '{print $1}' ### fails to show any data
Then I tried this:
curl -# -L --output-dir ${apps_dir} "${url}" -o "${file_name}" 2>&1 | stdbuf -o L tr '\r' '\n' | stdbuf -o L grep -Eo '[0-9.]*%'
The problem with the last line of code (note `-#`) is that it shows what I want but:
* prints out data on new line
* I don't know how to put the printout next to the string "Installing file..." (shame on me!)
Thank you!
https://redd.it/yi8sou
@r_bash
reddit
How can I get simple output from cURL download progress data?
I'm trying to "marry" `cURL` with `grep`|`awk`|`sed` to extract from the cURL output the real-time download percentage without using extra tools...
If first word starts with a vowel?
Hi, I’m trying to make a if statement that prints the 10 first lines if the first word in the file starts with a vowel. If not, it should print the 15 first lines in the file.
$first is the first word in the text file
words-sorted.txt is a text file containing a lot of random words
This is what I have tried:
if [[ "$first" == [^aeiou]* ]]
then
cat words-sorted.txt | head -n10
else
cat words-sorted.txt | head -n15
fi
I think there is something wrong with the «[^aeiou]*» part, but I don’t quite understand it.
Now it just prints the first 10 lines of the file, even if the first word starts with a consonant.
If I remove the «*» it print the first 15 lines, even if the first word starts with a vowel.
Any help is appreciated :)
https://redd.it/yidruk
@r_bash
Hi, I’m trying to make a if statement that prints the 10 first lines if the first word in the file starts with a vowel. If not, it should print the 15 first lines in the file.
$first is the first word in the text file
words-sorted.txt is a text file containing a lot of random words
This is what I have tried:
if [[ "$first" == [^aeiou]* ]]
then
cat words-sorted.txt | head -n10
else
cat words-sorted.txt | head -n15
fi
I think there is something wrong with the «[^aeiou]*» part, but I don’t quite understand it.
Now it just prints the first 10 lines of the file, even if the first word starts with a consonant.
If I remove the «*» it print the first 15 lines, even if the first word starts with a vowel.
Any help is appreciated :)
https://redd.it/yidruk
@r_bash
reddit
If first word starts with a vowel?
Hi, I’m trying to make a if statement that prints the 10 first lines if the first word in the file starts with a vowel. If not, it should print...
My first noscript, would appriacate feedback!
I wrote my first bash noscript for users and groups management, I've been studying on my own for around two weeks and thought I should try to write somthing.
The noscript is around 95% bash with little bit of awk.
I would appriacate any feedback or suggestion as for how to improve the noscript or what to learn next.
Also, I got help in this forum so I want to say thank you very much to anyone that helped!
Its too long to post here so I pasted it in github.
https://github.com/Kakabom/Kakabom/blob/main/Script.bash
https://redd.it/yilt70
@r_bash
I wrote my first bash noscript for users and groups management, I've been studying on my own for around two weeks and thought I should try to write somthing.
The noscript is around 95% bash with little bit of awk.
I would appriacate any feedback or suggestion as for how to improve the noscript or what to learn next.
Also, I got help in this forum so I want to say thank you very much to anyone that helped!
Its too long to post here so I pasted it in github.
https://github.com/Kakabom/Kakabom/blob/main/Script.bash
https://redd.it/yilt70
@r_bash
GitHub
Kakabom/Script.bash at main · Kakabom/Kakabom
Config files for my GitHub profile. Contribute to Kakabom/Kakabom development by creating an account on GitHub.
Use diff to find new usb port
Hi, I have a lot of usb ports on my pc and oftentimes I don't seem to find the right one under
Currently Im doing this:
\- I did a /dev/tty* snapshot with all usb devices I normally use plugged in and store it somewhere. The command is:
\-as I am plugging in a new usb device I run this noscript and get the newly added usb tty port:
​
I just wonder, whether there is a cleaner solution to get the same output.
​
Thank you
Edit: if it is important, I'm on a mac
https://redd.it/yipoqr
@r_bash
Hi, I have a lot of usb ports on my pc and oftentimes I don't seem to find the right one under
/dev/tty*. Is there a cleaner version of what I do here to detect a newly added usbport?Currently Im doing this:
\- I did a /dev/tty* snapshot with all usb devices I normally use plugged in and store it somewhere. The command is:
ls /dev/tty* > ~/somewhere/usbdevices \-as I am plugging in a new usb device I run this noscript and get the newly added usb tty port:
diff ~/somewhere/usbdevices <(ls /dev/tty*).​
I just wonder, whether there is a cleaner solution to get the same output.
​
Thank you
Edit: if it is important, I'm on a mac
https://redd.it/yipoqr
@r_bash
reddit
Use diff to find new usb port
Hi, I have a lot of usb ports on my pc and oftentimes I don't seem to find the right one under `/dev/tty*`. Is there a cleaner version of what I...
ssh with expect, send and interact
Have this code, which works as intended:
I would like to add another line under the one with "password:" for auto "sudo su -" . How can I do that? - Adding multiple expects. Adding the trigger keyword and the send doesn't work.
TIA
https://redd.it/yjfc69
@r_bash
Have this code, which works as intended:
exec expect -c "
spawn ssh user@host
expect {
"password:" {send "1234"}
}
interact timeout 3599 {send "000"}
"
I would like to add another line under the one with "password:" for auto "sudo su -" . How can I do that? - Adding multiple expects. Adding the trigger keyword and the send doesn't work.
TIA
https://redd.it/yjfc69
@r_bash
reddit
ssh with expect, send and interact
Have this code, which works as intended: ``` exec expect -c " spawn ssh user@host expect { "password:" {send...
How do you create custom user interfaces for bash noscripts?
Just something like telnet which gives you a > instead of hostname:username:workingdirectory$, and lets you run functions and commands in it, unlike (code here) where everything is executed after you close it with a ).
https://redd.it/yjgkh3
@r_bash
Just something like telnet which gives you a > instead of hostname:username:workingdirectory$, and lets you run functions and commands in it, unlike (code here) where everything is executed after you close it with a ).
https://redd.it/yjgkh3
@r_bash
reddit
How do you create custom user interfaces for bash noscripts?
Just something like telnet which gives you a > instead of hostname:username:workingdirectory$, and lets you run functions and commands in it,...
How to set Mouse Cursor to Busy (or diff cursor) Temporarily?
I have a noscript that runs for a bit so i would like to modify the mouse cursor to give some indication that its busy (e.g. hourglass). The cursor can be anything as long as its just not the current one.
After the noscript is done i would like it to return back to normal.
https://redd.it/yjnmzn
@r_bash
I have a noscript that runs for a bit so i would like to modify the mouse cursor to give some indication that its busy (e.g. hourglass). The cursor can be anything as long as its just not the current one.
After the noscript is done i would like it to return back to normal.
https://redd.it/yjnmzn
@r_bash
reddit
How to set Mouse Cursor to Busy (or diff cursor) Temporarily?
I have a noscript that runs for a bit so i would like to modify the mouse cursor to give some indication that its busy (e.g. hourglass). The cursor...
Extreme brain fart and I should know this. How do I expand the variables in this use case for a curl string?
So...
curl -k https://10.10.10.10:666/api/thing -b 'variable=$result'
The value of $result is what I need to have function out of single quotes here, and for some reason I'm either blanking on the correct terminology to google or man page to flip here.
Basically I'm gonna for loop through a bunch of files (thousands of lines each) and then spin up a ton of arbitrary dynamic curl commands to this API to have it do things.
What was the quoting/bracketing malarkey to make that $result expand properly into a usable form here? It's probably been 10+ years since I've done this...
https://redd.it/yjpzil
@r_bash
So...
curl -k https://10.10.10.10:666/api/thing -b 'variable=$result'
The value of $result is what I need to have function out of single quotes here, and for some reason I'm either blanking on the correct terminology to google or man page to flip here.
Basically I'm gonna for loop through a bunch of files (thousands of lines each) and then spin up a ton of arbitrary dynamic curl commands to this API to have it do things.
What was the quoting/bracketing malarkey to make that $result expand properly into a usable form here? It's probably been 10+ years since I've done this...
https://redd.it/yjpzil
@r_bash
reddit
Extreme brain fart and I should know this. How do I expand the...
So... curl -k https://10.10.10.10:666/api/thing -b 'variable=$result' The value of $result is what I need to have function out of single...
Run remote commands then connect to interactive shell
LTLFTP
Yall im lost and I need some serious help. I'm driving myself insane.
I have a giant ssh command that is running remote commands on a client server.
It's running this way without double quotes because
1) im connecting to a ksh shell
2) I have other commands running that use double quotes.
Is there ANY way I can add something to the end of my command string to drop me into a shell on the remote system?
https://redd.it/yjrtzt
@r_bash
LTLFTP
Yall im lost and I need some serious help. I'm driving myself insane.
I have a giant ssh command that is running remote commands on a client server.
ssh user@host \' command1 && command 2 && command3.....\'It's running this way without double quotes because
1) im connecting to a ksh shell
2) I have other commands running that use double quotes.
Is there ANY way I can add something to the end of my command string to drop me into a shell on the remote system?
https://redd.it/yjrtzt
@r_bash
reddit
Run remote commands then connect to interactive shell
LTLFTP Yall im lost and I need some serious help. I'm driving myself insane. I have a giant ssh command that is running remote commands on a...
Array looping to csv
Hello
I've written a noscript which saves arrays to csv however it not output how i expect it to be.
channel=($(seq 1 3)
channelid=(1 2 3)
channelname=(one two three)
echo channel, channelid, channelname > mycsv.csv
echo "${channel@}", "${channelid@}", "${channelname@" >> mycsv.csv
but this output as
channel, channelid, channelname
1 2 3, 1 2 3, one two three
what i was hoping it'd output as
channel, channelid, channelname
1,1,one
2,2,two
3,3,three
I know know i can re-write this as
echo channel, channelid, channelname > mycsv.csv
echo "${channel0}", "${channelid0}", "${channelname0" >> mycsv.csv
echo "${channel1}", "${channelid1}", "${channelname1" >> mycsv.csv
echo "${channel2}", "${channelid2}", "${channelname2" >> mycsv.csv
is there a more cleaner way to output arrays to csv without referring to index number?
https://redd.it/yjotom
@r_bash
Hello
I've written a noscript which saves arrays to csv however it not output how i expect it to be.
channel=($(seq 1 3)
channelid=(1 2 3)
channelname=(one two three)
echo channel, channelid, channelname > mycsv.csv
echo "${channel@}", "${channelid@}", "${channelname@" >> mycsv.csv
but this output as
channel, channelid, channelname
1 2 3, 1 2 3, one two three
what i was hoping it'd output as
channel, channelid, channelname
1,1,one
2,2,two
3,3,three
I know know i can re-write this as
echo channel, channelid, channelname > mycsv.csv
echo "${channel0}", "${channelid0}", "${channelname0" >> mycsv.csv
echo "${channel1}", "${channelid1}", "${channelname1" >> mycsv.csv
echo "${channel2}", "${channelid2}", "${channelname2" >> mycsv.csv
is there a more cleaner way to output arrays to csv without referring to index number?
https://redd.it/yjotom
@r_bash
reddit
Array looping to csv
Hello I've written a noscript which saves arrays to csv however it not output how i expect it to be. channel=($(seq 1 3) channelid=(1 2...
tr command not working inside noscript.
date +%X | tr ":" " " | cut -d " " -f1
This command gives only the hour from date command. It works fine on the console but doesn't work inside a bash noscript? How can I use it inside a noscript?
https://redd.it/yjztj7
@r_bash
date +%X | tr ":" " " | cut -d " " -f1
This command gives only the hour from date command. It works fine on the console but doesn't work inside a bash noscript? How can I use it inside a noscript?
https://redd.it/yjztj7
@r_bash
reddit
tr command not working inside noscript.
date +%X | tr ":" " " | cut -d " " -f1 This command gives only the hour from date command. It works fine on the console but doesn't work inside a...
brem - My first released noscript/program
After lurking on this subreddit for a while now, I've finally gathered the courage to write my first post and release my first real program/noscript. It's written in POSIX sh because I wanted to challenge myself a little and learn new stuff.
It's a notes/reminders management program, with a weird design decision about it's storage format.
I would greatly appreciate any feedback you might have!
https://gitlab.com/k\_lar/brem
https://redd.it/yk8jde
@r_bash
After lurking on this subreddit for a while now, I've finally gathered the courage to write my first post and release my first real program/noscript. It's written in POSIX sh because I wanted to challenge myself a little and learn new stuff.
It's a notes/reminders management program, with a weird design decision about it's storage format.
I would greatly appreciate any feedback you might have!
https://gitlab.com/k\_lar/brem
https://redd.it/yk8jde
@r_bash
GitLab
K_Lar / brem · GitLab
Continued 'last command' troubleshooting
Hey all, this is a revival of my previous post [https://www.reddit.com/r/bash/comments/xds4z6/printf\_vs\_echo\_showing\_last\_command/](https://www.reddit.com/r/bash/comments/xds4z6/printf_vs_echo_showing_last_command/)
I can't get any of the suggestions in that one to work.
I finally got a chance tonight to dig back into this a bit. I spent a bit of time going through shellcheck and fixing (surprisingly, to me) everything it came up with, even the cosmetic issues!
Anyway, my noscript is still failing to run for reasons I'm having difficulty googling or understanding.
Here's a link to a gist with the entirety (sanitized) of my noscript. This includes line numbers that are in line with the line numbers referenced in the shell output below.
[https://gist.github.com/bhoglan/b47809ac03a0ea878f0a01a9d90b54f3.js](https://gist.github.com/bhoglan/b47809ac03a0ea878f0a01a9d90b54f3.js)
And here's the shell output I get when I try to execute the noscript:
➜ docker1| shared: ./bookstackArchive.sh
./bookstackArchive.sh: line 39: :0: bad word specifier
./bookstackArchive.sh: line 39: syntax error near unexpected token `}'
./bookstackArchive.sh: line 1: /shared/archive.log: No such file or directory
Now, I've putzed around with the first error a bit. From the code I'm interpreting the !:0 as "Last *n* command" where *n* is the index of the command in my history, starting at 0, with 0 being the most recently run command. I was thinking that maybe it's interpreting the other stuff on line 39 as commands (date and echo) so I tried !:2 to get back to the command run that triggered the success, no dice, the error continues just with the updated index number.
The second error seems like nonsense to me given the context of line 39. I tried adding spaces and using things like \[\[ \]\], no joy.
The third error I just don't get. Line 1 in my noscript is the shebang. I played with the first instance of "/shared/archive.log" which appears on line 34, like maybe bash isn't interpreting the comment lines above as real lines? I dunno, I'm grasping at straws here.
I appreciate any advice or direction you can give. I'm learning a lot as I'm building these noscripts, most fundamentally, I think, is that I'm learning to think about things programmatically and how to tell a computer to solve problems.
Thanks all!
https://redd.it/yksdyz
@r_bash
Hey all, this is a revival of my previous post [https://www.reddit.com/r/bash/comments/xds4z6/printf\_vs\_echo\_showing\_last\_command/](https://www.reddit.com/r/bash/comments/xds4z6/printf_vs_echo_showing_last_command/)
I can't get any of the suggestions in that one to work.
I finally got a chance tonight to dig back into this a bit. I spent a bit of time going through shellcheck and fixing (surprisingly, to me) everything it came up with, even the cosmetic issues!
Anyway, my noscript is still failing to run for reasons I'm having difficulty googling or understanding.
Here's a link to a gist with the entirety (sanitized) of my noscript. This includes line numbers that are in line with the line numbers referenced in the shell output below.
[https://gist.github.com/bhoglan/b47809ac03a0ea878f0a01a9d90b54f3.js](https://gist.github.com/bhoglan/b47809ac03a0ea878f0a01a9d90b54f3.js)
And here's the shell output I get when I try to execute the noscript:
➜ docker1| shared: ./bookstackArchive.sh
./bookstackArchive.sh: line 39: :0: bad word specifier
./bookstackArchive.sh: line 39: syntax error near unexpected token `}'
./bookstackArchive.sh: line 1: /shared/archive.log: No such file or directory
Now, I've putzed around with the first error a bit. From the code I'm interpreting the !:0 as "Last *n* command" where *n* is the index of the command in my history, starting at 0, with 0 being the most recently run command. I was thinking that maybe it's interpreting the other stuff on line 39 as commands (date and echo) so I tried !:2 to get back to the command run that triggered the success, no dice, the error continues just with the updated index number.
The second error seems like nonsense to me given the context of line 39. I tried adding spaces and using things like \[\[ \]\], no joy.
The third error I just don't get. Line 1 in my noscript is the shebang. I played with the first instance of "/shared/archive.log" which appears on line 34, like maybe bash isn't interpreting the comment lines above as real lines? I dunno, I'm grasping at straws here.
I appreciate any advice or direction you can give. I'm learning a lot as I'm building these noscripts, most fundamentally, I think, is that I'm learning to think about things programmatically and how to tell a computer to solve problems.
Thanks all!
https://redd.it/yksdyz
@r_bash
reddit
printf vs echo - Showing last command
Hey all! I've been writing a pretty basic noscript to take care of some file backup tasks for me. I'm trying to be good by commenting and producing...
My first Bash noscript - Git / GitHub Automation noscript
I'm a complete beginner at bash noscripting.
I have written a Python noscript which creates a local git repository and also connects it to a remote repository on GitHub. I wanted to have an installer for this noscript as in I would run that installation file and then the executable Python noscript will be available in any directory.
I have written an installer noscript which writes to the .bash_profile file. Here is the link to my repository.
Is there a better way to do this? Sorry for the bad grammar, English is not my first language.
https://redd.it/yl32ro
@r_bash
I'm a complete beginner at bash noscripting.
I have written a Python noscript which creates a local git repository and also connects it to a remote repository on GitHub. I wanted to have an installer for this noscript as in I would run that installation file and then the executable Python noscript will be available in any directory.
I have written an installer noscript which writes to the .bash_profile file. Here is the link to my repository.
Is there a better way to do this? Sorry for the bad grammar, English is not my first language.
https://redd.it/yl32ro
@r_bash
GitHub
GitHub - sahil-sagwekar2652/GitHub-Automation-noscripts: Bash and Python noscripts to automate your Git & GitHub workflow. Idea from…
Bash and Python noscripts to automate your Git & GitHub workflow. Idea from Kalle Hallden. Improved by using only standard python libraries. Link to his version ⬇️ - GitHub - sahil-sagwekar26...
curl a file of data blocks with parallelism?
I'm trying to accomplish batching of millions of curl requests with different data blocks, for example..
curl --parallel --parallel-immediate --parallel-max 100 -X POST -H 'this header' -H 'that header' https://host/uri
I then want it to parse a list of data blocks, I tried using -K/--config and passing in: data="{\\"key\\": \\"value\\"}"
... but it wouldn't iterate through the file. I've read about using GNU parallel instead, but I'm not sure how I would parse a list of data blocks for the same curl command.
https://redd.it/yl693n
@r_bash
I'm trying to accomplish batching of millions of curl requests with different data blocks, for example..
curl --parallel --parallel-immediate --parallel-max 100 -X POST -H 'this header' -H 'that header' https://host/uri
I then want it to parse a list of data blocks, I tried using -K/--config and passing in: data="{\\"key\\": \\"value\\"}"
... but it wouldn't iterate through the file. I've read about using GNU parallel instead, but I'm not sure how I would parse a list of data blocks for the same curl command.
https://redd.it/yl693n
@r_bash
reddit
curl a file of data blocks with parallelism?
I'm trying to accomplish batching of millions of curl requests with different data blocks, for example.. curl --parallel --parallel-immediate...
How to make this into one-line?
MYVARIABLE="$(command1)"
command2
command3 $MYVARIABLE
Is there a way to avoid this
https://redd.it/ylbal3
@r_bash
MYVARIABLE="$(command1)"
command2
command3 $MYVARIABLE
Is there a way to avoid this
MY_VARIABLE stuff? The thing is, command2 must execute before command3; but command1 only returns the right value when executed before command2.https://redd.it/ylbal3
@r_bash
reddit
How to make this into one-line?
MY_VARIABLE="$(command1)" command2 command3 $MY_VARIABLE Is there a way to avoid this `MY_VARIABLE` stuff? The thing is, `command2` must...
Does sourcing another noscript affect -e option?
I have this test snippet and want to confirm if my assumption is true. It looks like the sourced noscript continues despite having -e option. But if the noscript is just executed, then -e option works as expected.
​
​
​
​
https://redd.it/ylhm3a
@r_bash
I have this test snippet and want to confirm if my assumption is true. It looks like the sourced noscript continues despite having -e option. But if the noscript is just executed, then -e option works as expected.
cat `a.sh`#!/bin/bashecho "Test 1"./b.shecho $?echo "Test 2"source ./b.shecho $?​
cat `b.sh`#!/bin/bash -els ~/doesntexist​
./a.shTest 1ls: cannnot access '/home/user/doesntexist': No such file or directory2Test 2ls: cannnot access '/home/user/doesntexist': No such file or directory2​
## modify `b.sh`cat `b.sh`#!/bin/bash -els ~/doesntexistecho "This shouldn't run"​
./a.shTest 1ls: cannnot access '/home/user/doesntexist': No such file or directory2Test 2ls: cannnot access '/home/user/doesntexist': No such file or directoryThis shouldn't run0https://redd.it/ylhm3a
@r_bash