Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
59 views

ZSH/Bash export variable from command substitution with spaces [duplicate]

I'm trying to set variables from the output of a command but bash and zsh are not respecting the quotes. $ export $(echo 'foo=one bar="two -x"') bash: export: `-x"': not a valid ...
Clint's user avatar
  • 101
0 votes
1 answer
34 views
+50

Execute shell script before UI Test for iOS app starts

I have UI test (for an iOS app) that opens iOS photo gallery and taps on specific image. I want to have custom script that will copy this image to simulator's photo gallery at the beginning of the ...
moonvader's user avatar
  • 20.9k
0 votes
0 answers
45 views

How to name each screen? [duplicate]

I have a list of screens like this. root@123:~# screen -ls There are screens on: 12497.1 (09/13/2024 10:58:02 PM) (Attached) 12416.2 (09/13/2024 10:51:26 PM) (Attached) 11988.3 (09/...
howtorollabluntinsixeasysteps's user avatar
0 votes
2 answers
93 views

find unique entries in one field across two CSV files with shell and friends

I have two CSV files I want to compare. The first looks like: aaaaaaaa-fb34-4e3e-aed5-eec78d02d59b,1234 bbbbbbbb-f76a-4a05-bb53-63aba9d03fe2,5678 cccccccc-e351-4d8e-b44a-080f6ccdef7d,9012 The second ...
tsj's user avatar
  • 782
0 votes
1 answer
35 views

how input string in adb shell command

I have command on bash: adb shell '/bin/sh -c "CLASSPATH=\$(pm path androidx.test.services) app_process / androidx.test.services.shellexecutor.ShellMain am instrument -w --no-window-animation -e ...
Red Cape's user avatar
0 votes
0 answers
14 views

ADB shell command to start a background process and get back its status in one line is failing with a syntax error

The below adb shell command returns /system/bin/sh: syntax error: unexpected ';' adb shell "tcpdump -W 3 -C 2 -i any -s 0 -w /tmp/net.pcap > /dev/null 2>&1 & ; echo x$?"
Britto's user avatar
  • 501
0 votes
0 answers
126 views

How to Open a New Terminal in WSL for Running Commands in a Shell Script

I have a Shell script that I originally wrote for an Ubuntu system with a desktop environment. The script makes use of gnome-terminal to open new terminal windows and execute certain commands. Here is ...
mustafa kaya's user avatar
-4 votes
0 answers
49 views

Loop with Delay in ubuntu

Hi I used this Code by run loop with delay in .sh file in ubuntu every line echo number and wait 40 minutes from 1 to 100 and try again Now with Run .sh file only run loop (do not wait for sleep ) and ...
Ramin Malekghasemi's user avatar
0 votes
1 answer
27 views

Run program after heredoc in same RUN statement in Dockerfile

I would like to create a file using heredoc and then run a command after in the same RUN statement in a Dockerfile. To illustrate, take this Dockerfile FROM alpine RUN export FOO=bar && \ ...
Hans Kilian's user avatar
  • 23.9k
0 votes
0 answers
18 views

Merge files with tigress-merge shows error <<Tigress.CIL-ERR-BAD-REQUEST>> : findlib: no such package goblint-cil

For a big project i need to merge files from coreutils. I found this project here where they tried to do it with cilly, but i can not make it work. Then i tried to switch to tigress, but i keep ...
Felpower's user avatar
  • 197
-2 votes
4 answers
111 views

How to use grep to check if a pattern line exists and write to another file?

I have log file with contents as like this The color is Orange then can used to binding. The color is Black then can used to binding. The animal Lion need to carefully. The color is Black then can ...
Brian Crist's user avatar
1 vote
4 answers
88 views

how to make sub-shell env variable available in the main shell python console?

I open a python console and run >>> import os >>> os.system("export aaa=123") >>> os.environ["aaa"] I see a key error. Why is that? How can I preserve ...
Amin Ba's user avatar
  • 2,276
1 vote
2 answers
64 views

Force word splitting for fallback value in sh/bash

I want use complex command as fallback value, something like this, but do not treat ls -sh as single string. "${@:-ls -sh}"
OwnageIsMagic's user avatar
0 votes
0 answers
65 views

Bash error trap does not catch stderr output after redirection to file

In my bash script I redirected stdout and stderr to a logs file to prevent it from being printed in the terminal. I set my script to exit on error occurrence using set -e switch. Now, whenever any ...
Krzysztoff's user avatar
0 votes
0 answers
45 views

How can a called external program unexpectedly interfere with the shell's variables in bash/sh/ash like this? [duplicate]

I have had a baffling issue for years where some programs (like ffmpeg) called from a while-loop in bash, sh or busybox ash interfere with either the read built-in or the shell itself, consistently on ...
mossymountain's user avatar
-2 votes
1 answer
85 views

update values in .cnf from .csv [closed]

I have the following .cnf [ policy_match ] countryName = match stateOrProvinceName = match organizationName = match organizationalUnitName = optional commonName = supplied emailAddress ...
foreverNoob's user avatar
0 votes
2 answers
81 views

How do I use aliases in the "sh -c" command? [duplicate]

I tried "sh -c [some alias]" but that didn't work, whereas running it directly was fine ~/.bashrc: alias ll=" ls -alF " There is the same problem in zsh, and technically I mainly ...
AlohaHenry's user avatar
0 votes
1 answer
39 views

Dockerfile to automatically build all csproj files in subfolders

I'm building an application with plugin architecture, so the source can contain many different plugins (but ordered in the same folder) like this: src - Dockerfile - mainProject - mainProject....
TheHvidsten's user avatar
  • 4,354
0 votes
1 answer
67 views

How can I daemonize a shell command?

In a shell script, I'm launching a long-running background process. After initialization, this process writes many lines of output. In my shell script, I'd like to continue with subsequent commands ...
Patrick Coppock's user avatar
0 votes
0 answers
32 views

Run curl with token authentication in shell script (Mac)

Trying to update data from a system using curl and url/token, but I am running into the following error. I believe the way I format the curl command in the shell script is incorrect but not sure how ...
Limerick's user avatar
0 votes
2 answers
50 views

How do I edit specific fields using sed?

I am facing trouble just with the modify_record function in the code provided below. I could use Awk but my instructor told us to do it using sed. Could anyone help in this? menu() { echo "...
Keklord's user avatar
0 votes
0 answers
37 views

How to create a file in a volume inline in Argo Workflow step

Currently, if I wanted to put several files into a volume inline, I would execute something like this: apiVersion: argoproj.io/v1alpha1 kind: WorkflowTemplate metadata: name: prepare-files-on-volume ...
Alechko's user avatar
  • 1,578
0 votes
0 answers
38 views

Replace strings in AndroidManifest.xml using shell [duplicate]

I want to replace something in AndroidManifest.xml using shell script. I use MPatcher tool to run .sh scripts on Android. My problem is that I can't replace those string: <uses-permission ...
Void Ray's user avatar
0 votes
0 answers
21 views

Problems with arguments passed to cmd.exe in sh script executed as pre-commit hook in Visual Studio

We have a very simple script running as a pre-commit hook for GIT on windows, here is the script: #!/bin/sh # important that it's got the .exe on the end! cmd.exe /c "run-tests-commit.cmd" ...
Meric Stanley's user avatar
0 votes
1 answer
32 views

Use .sh file to build image in docker compose

I have a docker compose file that works fine on my Windows/WSL environment. I am trying to deploy it to a Ubuntu server. I get the following error unable to prepare context: path "/home/dev/...
The Governor's user avatar
1 vote
0 answers
104 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,651
0 votes
1 answer
56 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
1 vote
5 answers
112 views

How to add headers to a CSV file which already has some headers in it

My requirement it to add the new headers to an existing CSV file which already has some headers in the fist line. I need to add the new headers at the end of the existing headers. The value of the new ...
Loganayaki mahalingam's user avatar
1 vote
3 answers
72 views

Why I have to specify - sh - -c - command instead of just - command in k8s livenessProbe exec command (and potentially elsewhere)

I'm trying to exec command in livenessProbe, I have connected to the container interactively and tested the command: exit $(test $(date +%H) -eq 3 && echo 1 || echo 0) which produced the ...
Aurimas Stands with Ukraine's user avatar
0 votes
1 answer
34 views

Does inline assigned variable followed by shell built-ins accessible by the subsequent commands?

I am trying to understand how posix shell behave when command is in the form, # variable assignment followed by a shell built-ins. var=value shell_builtins; in scenario like this, posix manual says, ...
nabik's user avatar
  • 45
0 votes
1 answer
38 views

Shell script repeating command for 1 argument (of 3) 3 times

I'm using a shell script in a gitlab ci pipeline to update .env variables depending on the branch's context. Overall it is working as expected, except that 1 of the 3 variables is being repeated 3 ...
Jowz's user avatar
  • 466
1 vote
2 answers
57 views

Variables set inside the rcfile are NOT accessible through Python

I've a shell script and a python script organized as follows (CAN NOT change the directory structure): ~ ├── a.py ├── b └── c.sh The MWEs are as follows: c.sh #!/bin/sh rcfile=$(mktemp) export ...
dibyendu's user avatar
  • 542
0 votes
0 answers
16 views

"end of file unexpected" error on my sh script, how can I fix this? [duplicate]

I keep getting the error, what's wrong with my sh script?? I'm very new to this and I don't fully understand what I'm doing but this should work right? v=0 while [1 == 1] do echo $v v=`...
captainretro's user avatar
0 votes
0 answers
30 views

Improving a configure.ac test

In configure.ac I have the following test: dnl $1 = MSG_CHECKING dnl Assemble and link assembly source $2 with extra $AS options $3 dnl and extra $LD options $4. When pattern $5 is found in `objdump -...
emacs drives me nuts's user avatar
1 vote
1 answer
82 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
0 votes
1 answer
158 views

comparison operator syntax in posix shell

I'm trying to understand the grammar/syntax of the shell command language (to be able to parse it) and I cannot seem to find where the syntax of the comparison operations is defined. As an example: x=...
Jeffrey Bonde's user avatar
-1 votes
1 answer
69 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
2 answers
66 views

using a pipe symbol in a jq command throws an error

I am having a shell script file validation-example.sh , it has the followign content expected_template = '{ "remoteIds": [ { "remoteId": "", "...
Starbucks Admin's user avatar
0 votes
0 answers
49 views

sh script not running inside a alpine:3.12 container when created from the image, but it is running when manually triggered inside the pod [duplicate]

Here is the Dockerfile I have used: FROM alpine:3.12 RUN apk add --no-cache util-linux python3 py3-pip RUN apk add --no-cache --upgrade bash COPY 1#check_dmesg_logs.sh /usr/local/bin/check-dmesg-logs....
Sourav Karmakar's user avatar
1 vote
0 answers
67 views

How can I test if a string contains a character in busybox sh?

I want to add an extension to a filename when it does not have one. I tried to determine whether the string contains a period but this did not work. #!/bin/sh dest=$2 if [ "$dest" != "....
J-A-Brown's user avatar
  • 135
0 votes
1 answer
78 views

How to get process filename (untruncated) from ps output?

I would like a script to be able to check if a given process is running, and also get its process ID (PID), and so I was looking at ps process output. If I execute with the cmd option for output, it ...
Rich Jahn's user avatar
  • 443
0 votes
0 answers
35 views

.desktop file executing .sh script containing a docker run command not working

I have a .sh script that executes a docker run command inside of it to start a containerized application. The script when executed directly works just fine starting the container and app inside it. ...
dev01's user avatar
  • 157
0 votes
1 answer
74 views

Why doesn't Docker open the new fd for CMD?

I'm trying to redirect stdout to /dev/null after duplicating it to fd 3 (in order to throw away a third-party library's use of stdout). This works just fine in a shell script (including a shell script ...
Patrick Coppock's user avatar
0 votes
0 answers
49 views

Run some commands as root in Android application

I have spent around 2days looking for an answer, but at a complete loss now. I'm writing an Android application in Kotlin that has to access a file node in /proc/xxxx/xxxxxx. (a). I have to setenforce ...
davidwangs's user avatar
0 votes
0 answers
38 views

Disable quote-escaping in Dockerfile

I'm trying to run a PostgreSQL Command using PSQL in a Dockerfile to prepare a database for a dev environment. The command is something like psql -c "CREATE ...". However, since Docker ...
Julius Babies's user avatar
0 votes
0 answers
31 views

Issue with shell script expect command

I am trying to run a shell script with "except" module for executing the below command [user1@scds2000025np certificate_renew]$ keytool -import -alias rootca0606 ...
yoyo's user avatar
  • 21
0 votes
1 answer
51 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,750
-1 votes
1 answer
90 views

Bash Flags are not passing through

For some reason, my flags are not being passed through. I'm using the unix getopts function, Where I am going wrong? #!/bin/bash ### Pass Flags #Define the help function function help(){ echo &...
Jason's user avatar
  • 627
0 votes
2 answers
65 views

extract individual files from concatenated gzipped files

I know that we can easily concatenate multiple gzipped files to create one big (valid) gzip file that contains all the data: gzip -c A > A.gz gzip -c B > B.gz cat A.gz B.gz > AB.gz If I then ...
umläute's user avatar
  • 30.7k
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
  • 5,082

1
2 3 4 5
172