need help with a grep noscript please
Hello everyone,
I am working on a weather project, and I have a .json file containing 5-day forecast information that I am trying to get specific information for 3 days from. I have 3 bash noscripts (bad noscripts) for tomorrow, the day after, and the day following. Each is meant to search the .json file and extract the weather icon code for that day. The .json file contains information in this format:
"dt_txt":"2024-06-08 06:00:00"},{"dt":1717837200,"main":{"temp":92.1,"feels_like":87.94,"temp_min":81.09,"temp_max":92.1,"pressure":1015,"sea_level":1015,"grnd_level":922,"humidity":16,"temp_kf":6.12},"weather":[{"id":800,"main":"Clear","denoscription":"clear sky","icon":"01n"}\]
there are 6 or 7 different entries for each date. All I want from the noscript is to read the first instance of any given date, and get the icon code from there. In the above case, "01n" is what I am looking for.
I cannot noscript and have spent many hours now with code generators that cannot successfully code this. What they produce keeps going deeper into the file and grabbing info from I don't know where.
Can anyone provide a working noscript that gets the information I am looking for?
Thank you for reading,
Logan
https://redd.it/1dautiw
@r_bash
Hello everyone,
I am working on a weather project, and I have a .json file containing 5-day forecast information that I am trying to get specific information for 3 days from. I have 3 bash noscripts (bad noscripts) for tomorrow, the day after, and the day following. Each is meant to search the .json file and extract the weather icon code for that day. The .json file contains information in this format:
"dt_txt":"2024-06-08 06:00:00"},{"dt":1717837200,"main":{"temp":92.1,"feels_like":87.94,"temp_min":81.09,"temp_max":92.1,"pressure":1015,"sea_level":1015,"grnd_level":922,"humidity":16,"temp_kf":6.12},"weather":[{"id":800,"main":"Clear","denoscription":"clear sky","icon":"01n"}\]
there are 6 or 7 different entries for each date. All I want from the noscript is to read the first instance of any given date, and get the icon code from there. In the above case, "01n" is what I am looking for.
I cannot noscript and have spent many hours now with code generators that cannot successfully code this. What they produce keeps going deeper into the file and grabbing info from I don't know where.
Can anyone provide a working noscript that gets the information I am looking for?
Thank you for reading,
Logan
https://redd.it/1dautiw
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
GitHub - thereisnotime/SheLLM: Shell wrapper that integrates LLMs assistance. Let the AI in your terminal
https://github.com/thereisnotime/SheLLM
https://redd.it/1dc8te6
@r_bash
https://github.com/thereisnotime/SheLLM
https://redd.it/1dc8te6
@r_bash
GitHub
GitHub - thereisnotime/SheLLM: Shell wrapper that integrates LLMs assistance right in your terminal
Shell wrapper that integrates LLMs assistance right in your terminal - thereisnotime/SheLLM
New to this, a simple noscript for yt-dlp that asks for -F 1/2/3/4 choice before downloading?
How do I go from 'hello world' to
where I can enter a number for a stream?
https://redd.it/1dc8qdi
@r_bash
How do I go from 'hello world' to
mynoscript urlwhere I can enter a number for a stream?
https://redd.it/1dc8qdi
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
What's a good project to step up my bash game?
Been on linux for a few years, the command line is not unfamiliar to me but I would still like to learn more. Any good projects to force me to learn?
https://redd.it/1dbd0lq
@r_bash
Been on linux for a few years, the command line is not unfamiliar to me but I would still like to learn more. Any good projects to force me to learn?
https://redd.it/1dbd0lq
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
This media is not supported in your browser
VIEW IN TELEGRAM
I wrote a stupid simple progress bar in pure BASH (source in comments)
https://redd.it/1dc1j8w
@r_bash
https://redd.it/1dc1j8w
@r_bash
what is the "ctrl i" shortcut?
hello, quick question
i was experimenting and i clicked "ctrl i" while in bash and it took the text i already put into the terminal and put ".save" at the end
what does this eman?
what is the "ctrl i" shortcut? what does it do?
thank you
https://redd.it/1dbpe7h
@r_bash
hello, quick question
i was experimenting and i clicked "ctrl i" while in bash and it took the text i already put into the terminal and put ".save" at the end
what does this eman?
what is the "ctrl i" shortcut? what does it do?
thank you
https://redd.it/1dbpe7h
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Bash history across different terminal sessions.
I use tillix for having multiple terminal windows open. After using different commands in different terminal windows, I checked bash history and it shows only some commands.
I thought bash history is tied to the user and not to the terminal session. What’s the probable explanation as to why not all the commands from all terminal sessions show in in bash history? I am using popOS!
https://redd.it/1ddcykx
@r_bash
I use tillix for having multiple terminal windows open. After using different commands in different terminal windows, I checked bash history and it shows only some commands.
I thought bash history is tied to the user and not to the terminal session. What’s the probable explanation as to why not all the commands from all terminal sessions show in in bash history? I am using popOS!
https://redd.it/1ddcykx
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Script stops when a command is run
I'm trying to run a bash noscript during which I move to a directory to run the “npm audit” command. This command seems to stop the execution of the current noscript.
The command :
I had the same problem on Windows. The solution I found was to run the command in another instance of cmd using the command :
The bash equivalent seems to be :
But that didn't change anything. Does anyone have any idea what's wrong?
https://redd.it/1ddh009
@r_bash
I'm trying to run a bash noscript during which I move to a directory to run the “npm audit” command. This command seems to stop the execution of the current noscript.
The command :
npm audit --json > “$OUTPUT_FILE”I had the same problem on Windows. The solution I found was to run the command in another instance of cmd using the command :
cmd /c npm audit --json > “%OUTPUT_FILE%”The bash equivalent seems to be :
bash -c “ npm audit --json > ‘%OUTPUT_FILE%’ But that didn't change anything. Does anyone have any idea what's wrong?
https://redd.it/1ddh009
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Select output by line similar to previous commands
Just like you can use the arrow keys to scroll through previous commands, is there a way to do the same for each line of output? So I don’t have to copy or type a certain value from a list of values every time I want to use it in my next command.
https://redd.it/1ddj2o0
@r_bash
Just like you can use the arrow keys to scroll through previous commands, is there a way to do the same for each line of output? So I don’t have to copy or type a certain value from a list of values every time I want to use it in my next command.
https://redd.it/1ddj2o0
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
mkdir with variables
I'm backing up my movie collection to my Plex server, which is running on Ubuntu Server LTS 22.04
I'm trying to write a bash noscript to create the directory and move the files over.
This is my code so far:
```
#!/bin/bash
movie="[Movie name] ([Year]) - [resolution] {imdb-[IMDb code]}"
file=$movie.mp4
path="\"/mnt/usb1/Movies/$movie\""
mkdir $path
```
But I get an error whenever trying to run it because it tries splits the directory up to a new one whenever it encounters a space, despite including double quotation marks in the "path" variable.
*The text in square brackets is only like that for the purpose of this example
Where am I going wrong?
https://redd.it/1ddp700
@r_bash
I'm backing up my movie collection to my Plex server, which is running on Ubuntu Server LTS 22.04
I'm trying to write a bash noscript to create the directory and move the files over.
This is my code so far:
```
#!/bin/bash
movie="[Movie name] ([Year]) - [resolution] {imdb-[IMDb code]}"
file=$movie.mp4
path="\"/mnt/usb1/Movies/$movie\""
mkdir $path
```
But I get an error whenever trying to run it because it tries splits the directory up to a new one whenever it encounters a space, despite including double quotation marks in the "path" variable.
*The text in square brackets is only like that for the purpose of this example
Where am I going wrong?
https://redd.it/1ddp700
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
what is the command for open Browser from bash shell?
Hi, I use command whereis for get dirs of browsers, so
what is the command for use that output of whereis?
for Falkon browser whereis says it is in /usr/bin/falkon
for Chromium whereis says /snap/bin/chromium and for FF the last same snap bin.
when I put snap bin chromium bashshell angry with me and complete the screen with lots of words... sorry my no EN, so whitch will be the command for open chroium from bash shell
Thank you and Regards!
https://redd.it/1ddrqbs
@r_bash
Hi, I use command whereis for get dirs of browsers, so
what is the command for use that output of whereis?
for Falkon browser whereis says it is in /usr/bin/falkon
for Chromium whereis says /snap/bin/chromium and for FF the last same snap bin.
when I put snap bin chromium bashshell angry with me and complete the screen with lots of words... sorry my no EN, so whitch will be the command for open chroium from bash shell
Thank you and Regards!
https://redd.it/1ddrqbs
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Cannot kill process 684 even with -9 option as sudo. Why is this the case?
ubuntu@ip:~$ ps aux | grep configurable-http-proxy
root 684 1.3 2.3 598796 47532 ? Ssl 03:28 0:00 node /usr/local/bin/configurable-http-proxy --ip --port 8000 --api-ip 127.0.0.1 --api-port 8001 --error-target http://127.0.0.1:8081/hub/error
ubuntu 802 0.0 0.1 7016 2304 pts/0 S+ 03:28 0:00 grep --color=auto configurable-http-proxy
When I ran the command, nothing happens. I ran the
https://redd.it/1ddx7ic
@r_bash
ubuntu@ip:~$ ps aux | grep configurable-http-proxy
root 684 1.3 2.3 598796 47532 ? Ssl 03:28 0:00 node /usr/local/bin/configurable-http-proxy --ip --port 8000 --api-ip 127.0.0.1 --api-port 8001 --error-target http://127.0.0.1:8081/hub/error
ubuntu 802 0.0 0.1 7016 2304 pts/0 S+ 03:28 0:00 grep --color=auto configurable-http-proxy
When I ran the command, nothing happens. I ran the
ps command again and I still see the process as active. Not sure how to kill it.https://redd.it/1ddx7ic
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Weird exit status behaviour.
I thought by default, when bash's exit builtin fails, it will not alter the current exit status. Confirmed by these cases:
$ bash -c 'exit 14'
$ exit 1 1
$ echo $?
14
$ :|exit 99
$ exit 2 2
$ echo $?
99
However, the behaviour is different when there was no previous command, in other words, in a newly spawned shell (where the initial exit status is 0).
$ exit 42 42
$ echo $?
1
Why does that happen? And more importantly, what could be the rationale behind this?
Also, somewhat related, exit's argument handling is weird. It only fails (and doesn't quit the current shell) when the first argument is a valid 64 bit number (up to leading&trailing whitespace) and there's at least one other argument (any string) after it. However, when the first argument is not numeric according to the aforementioned rules, it doesn't matter how many arguments you put, it will print an error and exit. It also doesn't quit the shell on --help as the 1st arg, however, this does set the exit status to 2.
https://redd.it/1de0a3n
@r_bash
I thought by default, when bash's exit builtin fails, it will not alter the current exit status. Confirmed by these cases:
$ bash -c 'exit 14'
$ exit 1 1
$ echo $?
14
$ :|exit 99
$ exit 2 2
$ echo $?
99
However, the behaviour is different when there was no previous command, in other words, in a newly spawned shell (where the initial exit status is 0).
$ exit 42 42
$ echo $?
1
Why does that happen? And more importantly, what could be the rationale behind this?
Also, somewhat related, exit's argument handling is weird. It only fails (and doesn't quit the current shell) when the first argument is a valid 64 bit number (up to leading&trailing whitespace) and there's at least one other argument (any string) after it. However, when the first argument is not numeric according to the aforementioned rules, it doesn't matter how many arguments you put, it will print an error and exit. It also doesn't quit the shell on --help as the 1st arg, however, this does set the exit status to 2.
https://redd.it/1de0a3n
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
dealing with float numbers in bash - #!/bin/bash
https://shnoscripts.com/dealing-with-float-numbers-in-bash/
https://redd.it/1dec1ux
@r_bash
https://shnoscripts.com/dealing-with-float-numbers-in-bash/
https://redd.it/1dec1ux
@r_bash
#!/bin/bash
dealing with float numbers in bash - #!/bin/bash
Dealing with float numbers in bash is not available by default. Learn how to perform arithmetic operations in bash for float numbers
bash noscript `sed` help
Hello, I am a college student working on a summer project, but I feel like I have been stuck for too long on this one thing.
**TLDR:** I am working on a bash noscript and am having issues with \`sed\` not putting markdown for an indented bullet point in front of the line for any ports it finds.
So I am trying to work on a bash noscript and I have been stuck on part using \`sed\` for two weeks, so I come to you all for help. So I am trying to search through an nmap scan that I have happening earlier in the noscript, and add the markdown for an indented bullet point to the port lines. If I understand correctly I should be able to use regex as the searching pattern in \`sed\`, but I have been able to get every other thing I need working except for this one.
I will put a bunch of lines I have tried at the bottom so maybe you can see my thinking/attempts, but I have 2 different theories as to why what I am trying isn't working. Oh, and with the fun 3rd theory of me missing something simple and obvious.
1: I believe \`sed\` looks at \`\*\` as whatever character is right before it? So maybe because I am using that as my bullet point markdown it's thinking its a space? But things still don't seem to work when I replace it with a \`-\` instead?
2: I am missing something about what's needed to add regex into sed. Nothing too fancy here, I think I have tried the right (~~various~~) arguments. On its own I am pretty sure that my regex is right as I can verify that on its own.
Here are a number of the commands that I have tried so far
\`sed -e '/\[0-9\]+\\/\[A-Za-z\]\[A-Za-z\]\[A-Za-z\]\[\[:space:\]\]+open/gm/$\\t \* \\/'\`
\`sed 's/\[0-9\]+\\/\[A-Za-z\]\[A-Za-z\]\[A-Za-z\]\[\[:space:\]\]/\\t \* &/'\`
\`sed -e .....; /\^\[0-9\]\\{1,5\\}\\/\[a-z\]{3}$/s/\^/\\t \* /;\`
\`awk '/\[a-z\]\[a-z\]\[a-z\] open|\[a-z\]\[a-z\]\[a-z\] open/ {print " \* " $0}' /home/$ownerAccount/Desktop/$projectName/AaFinalDoc.txt >> /home/$ownerAccount/Desktop/$projectName/BbFinalDoc.md\`
This project is larger than anything I have tried before and because its fun I just keep adding to it after I finish the previous goal. I have historically been really bad in my programming classes but this feels fun so I don't want to give up!
I appreciate any help that any of you can give me, thank you!
EDIT: warrior0x7 pointed out I dont actually show my start and end goals, so here is an example that hopefully might help.
Nmap scan report for
PORT STATE SERVICE VERSION
8008/tcp open http?
8009/tcp open ssl/ajp13?
8443/tcp open ssl/https-alt?
9000/tcp open ssl/cslistener?
10001/tcp open ssl/scp-config?
MAC Address: 1C:53: (Google)
Aggressive OS guesses: Android 6.0 - 7.1.2 (Linux 3.18 - 4.4.1)
TRACEROUTE
1 66.90 ms 192.168.
Nmap scan report for 192.168.
PORT STATE SERVICE VERSION
8008/tcp open http?
8009/tcp open ssl/ajp13?
8443/tcp open ssl/https-alt?
9000/tcp open ssl/cslistener?
9080/tcp open glrpc?
10001/tcp open ssl/scp-config?
MAC Address: 1C:53: (Google)
Aggressive OS guesses: Android 6.0 - 7.1.2 (Linux 3.18 - 4.4.1)
TRACEROUTE
1 44.48 ms 192.168
Nmap scan report for 192.168.
PORT STATE SERVICE VERSION
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
445/tcp open microsoft-ds?
5357/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
MAC Address: D8:BB: (Micro-Star Intl)
Device type:
Aggressive OS guesses: Microsoft Windows 11 21H2 (97%)
TRACEROUTE
1 2.13 ms 192.168.
But the only thing I am looking at to alter (with this line that I am having issues with) is the ports. I already have adding markdown working for what I want to do to every other line. So that end result looks like this.
Nmap scan report for
PORT STATE SERVICE VERSION
* 8008/tcp open http?
* 8009/tcp open ssl/ajp13?
*
Hello, I am a college student working on a summer project, but I feel like I have been stuck for too long on this one thing.
**TLDR:** I am working on a bash noscript and am having issues with \`sed\` not putting markdown for an indented bullet point in front of the line for any ports it finds.
So I am trying to work on a bash noscript and I have been stuck on part using \`sed\` for two weeks, so I come to you all for help. So I am trying to search through an nmap scan that I have happening earlier in the noscript, and add the markdown for an indented bullet point to the port lines. If I understand correctly I should be able to use regex as the searching pattern in \`sed\`, but I have been able to get every other thing I need working except for this one.
I will put a bunch of lines I have tried at the bottom so maybe you can see my thinking/attempts, but I have 2 different theories as to why what I am trying isn't working. Oh, and with the fun 3rd theory of me missing something simple and obvious.
1: I believe \`sed\` looks at \`\*\` as whatever character is right before it? So maybe because I am using that as my bullet point markdown it's thinking its a space? But things still don't seem to work when I replace it with a \`-\` instead?
2: I am missing something about what's needed to add regex into sed. Nothing too fancy here, I think I have tried the right (~~various~~) arguments. On its own I am pretty sure that my regex is right as I can verify that on its own.
Here are a number of the commands that I have tried so far
\`sed -e '/\[0-9\]+\\/\[A-Za-z\]\[A-Za-z\]\[A-Za-z\]\[\[:space:\]\]+open/gm/$\\t \* \\/'\`
\`sed 's/\[0-9\]+\\/\[A-Za-z\]\[A-Za-z\]\[A-Za-z\]\[\[:space:\]\]/\\t \* &/'\`
\`sed -e .....; /\^\[0-9\]\\{1,5\\}\\/\[a-z\]{3}$/s/\^/\\t \* /;\`
\`awk '/\[a-z\]\[a-z\]\[a-z\] open|\[a-z\]\[a-z\]\[a-z\] open/ {print " \* " $0}' /home/$ownerAccount/Desktop/$projectName/AaFinalDoc.txt >> /home/$ownerAccount/Desktop/$projectName/BbFinalDoc.md\`
This project is larger than anything I have tried before and because its fun I just keep adding to it after I finish the previous goal. I have historically been really bad in my programming classes but this feels fun so I don't want to give up!
I appreciate any help that any of you can give me, thank you!
EDIT: warrior0x7 pointed out I dont actually show my start and end goals, so here is an example that hopefully might help.
Nmap scan report for
PORT STATE SERVICE VERSION
8008/tcp open http?
8009/tcp open ssl/ajp13?
8443/tcp open ssl/https-alt?
9000/tcp open ssl/cslistener?
10001/tcp open ssl/scp-config?
MAC Address: 1C:53: (Google)
Aggressive OS guesses: Android 6.0 - 7.1.2 (Linux 3.18 - 4.4.1)
TRACEROUTE
1 66.90 ms 192.168.
Nmap scan report for 192.168.
PORT STATE SERVICE VERSION
8008/tcp open http?
8009/tcp open ssl/ajp13?
8443/tcp open ssl/https-alt?
9000/tcp open ssl/cslistener?
9080/tcp open glrpc?
10001/tcp open ssl/scp-config?
MAC Address: 1C:53: (Google)
Aggressive OS guesses: Android 6.0 - 7.1.2 (Linux 3.18 - 4.4.1)
TRACEROUTE
1 44.48 ms 192.168
Nmap scan report for 192.168.
PORT STATE SERVICE VERSION
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
445/tcp open microsoft-ds?
5357/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
MAC Address: D8:BB: (Micro-Star Intl)
Device type:
Aggressive OS guesses: Microsoft Windows 11 21H2 (97%)
TRACEROUTE
1 2.13 ms 192.168.
But the only thing I am looking at to alter (with this line that I am having issues with) is the ports. I already have adding markdown working for what I want to do to every other line. So that end result looks like this.
Nmap scan report for
PORT STATE SERVICE VERSION
* 8008/tcp open http?
* 8009/tcp open ssl/ajp13?
*
8443/tcp open ssl/https-alt?
* 9000/tcp open ssl/cslistener?
* 10001/tcp open ssl/scp-config?
MAC Address: 1C:53: (Google)
Aggressive OS guesses: Android 6.0 - 7.1.2 (Linux 3.18 - 4.4.1)
TRACEROUTE
1 66.90 ms 192.168.
Nmap scan report for 192.168.
PORT STATE SERVICE VERSION
* 8008/tcp open http?
* 8009/tcp open ssl/ajp13?
* 8443/tcp open ssl/https-alt?
* 9000/tcp open ssl/cslistener?
* 9080/tcp open glrpc?
* 10001/tcp open ssl/scp-config?
MAC Address: 1C:53: (Google)
Aggressive OS guesses: Android 6.0 - 7.1.2 (Linux 3.18 - 4.4.1)
TRACEROUTE
1 44.48 ms 192.168
Nmap scan report for 192.168.
PORT STATE SERVICE VERSION
* 135/tcp open msrpc Microsoft Windows RPC
* 139/tcp open netbios-ssn Microsoft Windows netbios-ssn
* 445/tcp open microsoft-ds?
* 5357/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
MAC Address: D8:BB: (Micro-Star Intl)
Device type:
Aggressive OS guesses: Microsoft Windows 11 21H2 (97%)
TRACEROUTE
1 2.13 ms 192.168.
Hopefully that helps to clarify things.
https://redd.it/1dec1ti
@r_bash
* 9000/tcp open ssl/cslistener?
* 10001/tcp open ssl/scp-config?
MAC Address: 1C:53: (Google)
Aggressive OS guesses: Android 6.0 - 7.1.2 (Linux 3.18 - 4.4.1)
TRACEROUTE
1 66.90 ms 192.168.
Nmap scan report for 192.168.
PORT STATE SERVICE VERSION
* 8008/tcp open http?
* 8009/tcp open ssl/ajp13?
* 8443/tcp open ssl/https-alt?
* 9000/tcp open ssl/cslistener?
* 9080/tcp open glrpc?
* 10001/tcp open ssl/scp-config?
MAC Address: 1C:53: (Google)
Aggressive OS guesses: Android 6.0 - 7.1.2 (Linux 3.18 - 4.4.1)
TRACEROUTE
1 44.48 ms 192.168
Nmap scan report for 192.168.
PORT STATE SERVICE VERSION
* 135/tcp open msrpc Microsoft Windows RPC
* 139/tcp open netbios-ssn Microsoft Windows netbios-ssn
* 445/tcp open microsoft-ds?
* 5357/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
MAC Address: D8:BB: (Micro-Star Intl)
Device type:
Aggressive OS guesses: Microsoft Windows 11 21H2 (97%)
TRACEROUTE
1 2.13 ms 192.168.
Hopefully that helps to clarify things.
https://redd.it/1dec1ti
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Ignore error and continue with other files
Hi all, I can't seem to use the right search words to find what I'm looking for so I am braving r/bash with my query.
I have \~70 fastq.gz files in a directory that I need to unzip. Easy peesy, right?:
Turns out, some of the files are corrupted and this results in an error. The command simply stops and none of the other files get unzipped. How can I skip bad files and unzip good files?
https://redd.it/1delnyw
@r_bash
Hi all, I can't seem to use the right search words to find what I'm looking for so I am braving r/bash with my query.
I have \~70 fastq.gz files in a directory that I need to unzip. Easy peesy, right?:
gzip -d *.gzTurns out, some of the files are corrupted and this results in an error. The command simply stops and none of the other files get unzipped. How can I skip bad files and unzip good files?
https://redd.it/1delnyw
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Easy question
At first I'm new to noscripting and this is for sure an easy question for you but:
I have a variable with file names separated by a space, like "FileA.txt FileB.txt FileC.txt".
I simply want to move those files to another directory. How can I get those file names readable for Linux?
https://redd.it/1deya1g
@r_bash
At first I'm new to noscripting and this is for sure an easy question for you but:
I have a variable with file names separated by a space, like "FileA.txt FileB.txt FileC.txt".
I simply want to move those files to another directory. How can I get those file names readable for Linux?
https://redd.it/1deya1g
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
What does ${0%/} mean exactly
I've got a noscript that creates backups of my various machines on my network. I have the .sh file located in a directory on my nas and then my machines just access the nas to run the noscript.
I was having trouble figuring out how to set the working directory to the directory that the noscript is located in so I can store all the backups in the same directory. I did some research and discovered the line:
cd "${0%/}"
This line works and does exactly what I need but, I'd like to know what it means. I know cd and I know what the quotes mean but everything within the quotes is like a foreign language to me but I'd like to understand.
Thanks in advance
https://redd.it/1dfdjg4
@r_bash
I've got a noscript that creates backups of my various machines on my network. I have the .sh file located in a directory on my nas and then my machines just access the nas to run the noscript.
I was having trouble figuring out how to set the working directory to the directory that the noscript is located in so I can store all the backups in the same directory. I did some research and discovered the line:
cd "${0%/}"
This line works and does exactly what I need but, I'd like to know what it means. I know cd and I know what the quotes mean but everything within the quotes is like a foreign language to me but I'd like to understand.
Thanks in advance
https://redd.it/1dfdjg4
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community