Questions tagged [bash]

0 votes
0 replies
Use custom command within a string [duplicate]
I'm encountering an issue passing an argument to a command in a Bash script. poc.sh: #!/bin/bash ARGS='"hi there" test' ./swap ${ARGS} swap:...
0 votes
1 replies
How to echo this entire code to .bashrc without leaving out characters/strings? [duplicate]
This question already has an answer here: How do I properly quote this bash pipeline for watch?...
asked 1 month ago
0 votes
0 replies
Kill background process started from the same bash script [duplicate]
I have a script that looks like this: pushd . nohup java -jar test/selenium-server.jar > /dev/null 2>&1 & cd web/code/protected/te...
asked 1 month ago
0 votes
0 replies
How to parse the result of a diff in a script?
I'm writing an script that should compare 2 directories and the files inside them and then parse the differences from A.xml to B.xml. I'm a litt...
asked 1 month ago
2 votes
3 replies
How to print out files using if not condition in bash
Say I have three files in a directory dir touch a.ym b.ym a.job And I need to print all *.ym if it has no corresponding *.job file. So this w...
asked 1 month ago
0 votes
1 replies
Installing node on Windows with bash
I went to nodejs.org and used the wizard to install node on the latest Windows 10. I also enabled the Windows Subsystem for Windows and downloa...
0 votes
5 replies
Return the read cursor to the start of the file
I'm trying to read into two file (name,number) at the same time and get value of each possible pair. The two file are like this: *name1 John...
asked 1 month ago
0 votes
1 replies
How to extract string from a log file
I have a log file and I want to write a bash script to parse out information from that log to another .txt file. I get stuck on how to allow user...
asked 1 month ago
-1 votes
1 replies
grep won't stop sending data to a string
I have a very simple script that scans a file for a string and if it finds it, it sends that string to a file. My problem is that the command loo...
asked 1 month ago
-2 votes
0 replies
Is there a Linux utility (like dd) with that I can write into the space between partitions? [closed]
I want to write to space or sectors between partitions to either copy a keyfile there or create one from random data that I have written into tha...
asked 1 month ago
1 votes
0 replies
Pass variable by reference [duplicate]
I want to ask if it is possible to pass arguments to a script function by reference: i.e. to do something that would look like this in C++: voi...
asked 1 month ago
-4 votes
0 replies
how i can check two lines into a loop
could you help me with this bash script i want to add a value between the lines so the lines it is start with ENTRIES but the next lines it is s...
asked 1 month ago
1 votes
0 replies
how to use global laravel command in .sh file?
I'm just writing a custom script to create a new Apache 2 virtualhost with automatical installation of a new laravel project. I had already sett...
asked 1 month ago
0 votes
0 replies
Read/Merge properties file into 1 line, ignoring comments in unix shell
Environment: Unix shell (e.g. BusyBox, using #!/bin/sh) Task: Read a properties file into a single variable, ignoring comments (#) and empty lin...
asked 1 month ago
0 votes
0 replies
why isn't $computer_choice random?
so i've never really took any classes in programming, i've only followed a few tutorials on youtube and tried to start coding myself from scratch...
asked 1 month ago
1 votes
1 replies
Unable to install a python package on zsh but successful on bash
I want to install papermill[s3] using pip. The command indicated in the traceback is: pip install papermill[s3]. However, when I run the command...
asked 1 month ago
-3 votes
0 replies
Cannot find correct version of awk error in my code [closed]
I have a shellscript that has awk command. Most of the time it works but sometimes, it doesn't. The error is: Cannot find correct version of...
asked 1 month ago
0 votes
0 replies
Drag and drop files to a bash script causes “Permission denied” when you output data to a file
I need to work with different files in the script. The easy and convenient way to do it is to use "Drag and drop". But. Drag and drop files to a...
asked 1 month ago
0 votes
1 replies
How to fix an exit code from if/while statement
I'm trying to add cleanup to some existing bash scripts, their functionality relevant to this question is that they create a log file and have mu...
asked 1 month ago
0 votes
0 replies
How to replace a FNR option value of AWK command in a for loop? [duplicate]
This question already has an answer here: Difference between single and double quotes in Bash...
asked 1 month ago
0 votes
0 replies
How to write powershell script which will execute python ones using specific venv?
I have written some web scraping python scripts, which I want to run regulary on Windows Server. I was ordered to write powershell script which c...
1 votes
2 replies
Substituting nth occurrence of a string in a for loop, in a file, with another string using sed
I am trying to replace the (j+1)th occurrence of "Nb " with Nbu in my file that looks like this: Nb Nbc blahblahblah Nb blablablaNbblabla Cd...
asked 1 month ago
1 votes
2 replies
loop to test all NFS mount point
this code work very well mountpoint="/mnt/testnfs" read -t1 < <(stat -t "$mountpoint" 2>&-) if [ -z "$REPLY" ] ; then echo "NFS mou...
asked 1 month ago
0 votes
2 replies
string split delimiter in bash returns double the size
The following bash script returns 4 while it should be 2 that is 2 IPS. #!/bin/bash STR="1.1.1.1***2.2.2.2" IFS="***" read -ra IPArray <<...
asked 1 month ago
0 votes
2 replies
How to suppress KeyboardInterrupt output when running a python script on bash?
I decide to run a python script from my bash terminal prompt, e.g. running $ python my_script.py. I then decide to press Ctrl-C to kill this act...
asked 1 month ago