Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
1 vote
2 answers
31 views

Using sed to remove differences in two arrays (updated ssh keys)

My aim is to updated automate the update of ssh keys in the authorized_keys file. Due to restrictions i am unable to use ansible which would have been a lot simpler. Steps: read keys from the file ...
Drey''s user avatar
  • 15
-1 votes
5 answers
82 views

How do I delete all the lines that match and one after each of them?

I have a large file and a list of my specific strings. The output should not contain my specific lines and one more after each of them. 2 consecutive matches are impossible due to structure of file ...
Женя Гончаров's user avatar
1 vote
1 answer
39 views

How to run a bash script using bash using Docker-in-Docker

I have a bash script that I use to build my Docker images and I'm trying to set up my GitLab CI so that it automatically builds the image whenever I push a tag. This is my .gitlab-ci.yml file: stages: ...
dokgu's user avatar
  • 5,718
-1 votes
0 answers
19 views

--include option in grep working different in .bashrc method [duplicate]

When I run grep -ril --include "gokp*" "blah" . --exclude-dir=deployBuild from a bash shell I get the following output: ./general/dbprocs/gokpve1.sql ./general/dbprocs/gokpven.sql ....
Shaun's user avatar
  • 1
0 votes
1 answer
50 views

How to evaluate 2 variables using bash arithematic in if statement with AND operator in bash shell [duplicate]

I have an alphanumeric string, say something like "XXXX24Y2" from which i have extracted only the numbers and assigned them to 2 variables, say num1 and num2, say num1=24 and num2=2 Now i ...
Aditi 's user avatar
0 votes
4 answers
86 views

Not getting the desired result in the shell script

I am trying to search a particular pattern "JOB" in all the files in the mentioned directories, and the checking if the next word after JOB has at least 5 characters and if the 5th character ...
raymond indwar's user avatar
0 votes
0 answers
29 views

When I try to add a new user by "useradd -c" inside while loop in Ubuntu24.04 doens't work, but at the other Ubuntu version the same script works

I'm a new student at the Linux Command and Shell Script and I'm reading the book called Linux Command Line and Shell Scripting Bible, Third Edition. In this book, on the 361 page, there is a script ...
Leonardo Teramatsu's user avatar
3 votes
1 answer
60 views

bash error message seemingly comes from environment instead of from bash itself when executing inside a function

Consider the following simple bash script cd nowhere This results in an error message something like my-script.sh: line 1: cd: nowhere: No such file or directory So far so good. This makes sense. ...
Mark VY's user avatar
  • 1,629
0 votes
1 answer
30 views

Cron call vs CLI call on Ubuntu [closed]

I am running into a weird issue. Cron call vs CLI call on Ubuntu 16. It checks 5 different docker containers. requestLogExistsInCon=$(docker exec -it myapp_${_docker_container_count}_1 sh -c "...
user3008410's user avatar
-2 votes
0 answers
34 views

How to use a large number of credentials with a bash script [closed]

I have a script that needs to store a large number of usernames and passwords. Basically what my script does is it fetches the customer usernames and passwords to execute an API link to check every ...
AnonymousDev's user avatar
-1 votes
1 answer
53 views

How do make a custom command to be executed directly from a folder using bash

I want to create a custom command that executes a bash script when a use types it in the terminal. So for example when they type in project setup it executes the setup bash script and then they can ...
Caden's user avatar
  • 67
-1 votes
0 answers
29 views

source $HOME/.bash_profile does not save the Output after reboot

I have created a simple Shell script using the below commands. # Setting the JAVA_HOME PATH in .bash_profile. NOTE: - We need to run this only if we are downloading the Java and running it manually. ...
Support Test email account's user avatar
-1 votes
0 answers
12 views

character like '\' coming in SQL output while assigning the output to a variable in shell script [duplicate]

I am trying to run a SQL query in shell script and assigning its output to a variable. When I run the script in Putty in the output variable character like \ is coming in data. But when I run the same ...
Rohit Bansal's user avatar
0 votes
1 answer
41 views

sed command is not replacing the files in my directory [duplicate]

When I run my bash script(given below) the files are not changed. The replacement does not happen for some reason. I am running the command as sudo, and the html folder has permssions 775 with the ...
Gavin Mitchel Dundee's user avatar
0 votes
1 answer
40 views

How to assign the result of mysqldump command into a variable?

In my bash script, I have tried dumpresult=$(mysqldump --user="${dbuser}" --password="${dbpw}" ${dbname} > ${desdir}/${filename_sql}) and dumpresult=`mysqldump --user="${...
Gary U.U. Unixuser's user avatar

15 30 50 per page
1
2 3 4 5
2600