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

All Questions

Tagged with
1 vote
0 answers
69 views

exit status of if statement in bash when condition is false

If I run help if in bash then it tells me that the exit status is "the status of the last command executed". Let's try it: if false; then echo we never get here fi echo $? The last ...
Mark VY's user avatar
  • 1,639
0 votes
1 answer
53 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
-2 votes
0 answers
35 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
0 answers
22 views

When I try to change a variable in a file I stack with error [duplicate]

I have two bash files: 1: #!/bin/bash PATH="/home/jk/go/src/emdr/emd_server" sed -i 's|^COMPOSE="[^"]*"|COMPOSE="'$PATH'/docker_compose.yml"|' "$PATH/up/...
Neverhood's user avatar
1 vote
1 answer
74 views

How to manage non ASCII characters inside sh/bash scripts

My terminal.txt file in the sequel shows the output of my tmpPdfFile.sh and tmpPdfFile1.sh scripts: both scripts are unable to properly manage the file "6._ANbertà_di_scelta.docx.pdf" The ...
Flavio Sartoretto's user avatar
-1 votes
1 answer
48 views

Variable expansion in "Run" command in docker [duplicate]

Example 1:- FROM ubuntu:latest SHELL ["/bin/bash", "-c"] RUN echo "export MY_VARIABLE=my_value" >> ~/.profile RUN cat ~/.profile RUN "source ~/.profile &&...
nayak0765's user avatar
  • 193
0 votes
1 answer
46 views

multiple call of exec > >(tee -a "${logFile}") 2>&1 with different log files

Look like if I call exec > >(tee -a "${logFile}") 2>&1 multiple times in the same script with different log files, the first log files will get appended multiple times. Is there ...
Nam Nguyen's user avatar
  • 5,740
-1 votes
1 answer
71 views

Bash Flags are not passing through

I need help with this bash script please. For some reason, my flags are not being passed through. I'm using the unix getopts function, Could someone take a look and let me know where I am going wrong? ...
Jason's user avatar
  • 617
0 votes
0 answers
13 views

Docker on Windows: OCI runtime create failed: unable to start container process: "bash": no such file or directory [duplicate]

I'm trying to run a Docker container on my Windows machine to execute some reformatting commands using poetry, isort, and black. Here is the relevant part of my Makefile: .PHONY: reformat reformat: ...
Underoos's user avatar
  • 4,992
0 votes
0 answers
45 views

How to concat a string after a variable (exported) in shell script [duplicate]

I have two shell scripts. SetEnvVariable.sh MigrationOperator.sh In SetEnvVariable.sh I'm setting a variable called CONNECT_POD_RESOURCE_NAME by doing below export CONNECT_POD_RESOURCE_NAME="...
Amit's user avatar
  • 1,861
1 vote
1 answer
55 views

How to keep last few numbers of lines or last few numbers of bytes from each file of folder recursively and save with same name keeping hierarchy

I have logs folder under which there can be nested sub folders. I want to operate on each file recursively and keep last few bytes (tail -c) or last few lines (tail -n) based on configuration and ...
sdindiver's user avatar
  • 519
0 votes
1 answer
88 views

nohup has no effect when called from background service?

I have a java application which is running as background service on a ubuntu system. The application is running under root account and is started/stopped via systemctl. The application has an auto-...
Christian's user avatar
  • 114
0 votes
0 answers
63 views

reboot via script run by cron

I'm going nuts over something seemingly simple. I want to run a script every minute which reboots when it finds something in a log. It simply does not run via cron. My script in /home/root/...
twsnnl's user avatar
  • 1
0 votes
1 answer
66 views

How can extract data single line from file and other process in each that line? [closed]

i have log file with contents inside. i.e file name is convert.20231010.log. The content inside file as below 2024-05-17 00:14:02.447 Success ABCXYZ15 on hard disk 2024-05-17 00:14:02.447 Fail at /...
Headshot's user avatar
  • 452
0 votes
0 answers
52 views

Hard Link is breaking with npm install

We had same code for windows and mac users and we use electron. So we create a separate package-win.json, package-lock-win.json for windows and package-mac.json, package-lock-mac.json for mac. Now ...
Nikhil Gupta's user avatar

15 30 50 per page
1
2 3 4 5
284