Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 4 years ago. Improve this question I am trying to write a Linux bash script that will
Tag: scripting
bash: string value based entries filtering
I have this check in my script: It is writing lines that contain contact* from one file to an array. How can I add another check that will skip the xi* values in that line and write it in the array? I tried something like: But it is not working for me. :/ Answer The first file looks like this:
How to simplify the comparison in the bash?
how to make several comparisons in the bash by placing the condition and comparison points next to instead of the long queue ? that something like this before : after (what I want): Answer Try this using bash regex with the keywork =~: Edit : As seen in comments, for real you need to compare int, not strings, so :
having an issue with my bash script
im writing a script that allows the user to create a backup of a file they choose by allowing them to input the file name. the file will then have backup followed by being date stamped at the end of it’s name and saved on the home drive. but whenever i try to run it i get an error: cp:
Looping a bash script
this is my first time dabbling in bash scripting and first time using this site. I’m working on script that’s meant to provide the user with a list of software packages to install and then output their choices into a 2nd script file that can be run later to actually install their choices. So far my script is semi working,
Bash script that will read a number from file and run command if number equals or is higher than X value
I would like to have a script that reads a number from a file, and if this number equals or higher a certain value, it will run another command, if not, script will just die, it would be something like this: Thanks for any help. Answer
Getting the User ID from the last line of the /etc/passwd file in Linux
I’ve been trying the following: and These statements aren’t working, I’m not sure how to join both of them to get the result I want. It just takes the current command that is in front of the /etc/passwd directory. I’m fairly new to Linux and combining commands together. Thank you for the help in advance. Answer Try: Or: Notes The
empty an existing array in ksh
I have script which stores the list of files in an array as shown below I have to empty this my_array variable to use it for other purpose. I cannot declare another new array. Is there any way to clear the content of the array and reuse it again? Thanks in advance. Answer Since you’re already using set -A …
Set docker image username at container creation time?
I have an OpenSuse 42.3 docker image that I’ve configured to run a code. The image has a single user(other than root) called “myuser” that I create during the initial Image generation via the Dockerfile. I have three script files that generate a container from the image based on what operating system a user is on. Question: Can the username
How to run iterations asynchronously in shell script
I have a few .csv files like below. xyz0900@1#-1637746436.csv xxx0900@1#-1637746436.csv zzz0900@2#-1637746439.csv yyy0900@1#-1637746436.csv sss0900@2#-1637746439.csv I have written a script to perform below tasks: Get the large file based on the pattern which we have passed as a argument to the script. Merge all other files which are having same pattern and create a new file Remove duplicate header from new file.