Category "bash"

How to prompt the commands that are written in a text file previously for spike?

I am using Spike to run a RISCV CPU. I will write the same set of commands many times that I wrote below run 100 reg 0 run 100 reg 0 run 100 reg 0 I actually

Raspberry Pi - fbi process blocking Teamviewer

I might have a rare case, but at the moment I'm not able to find a solution for this problem. I've installed a RaspberryPi 3 in a local business to display imag

How to find file path to a bash file when the folder is renamed or moved to a new drive?

I've made an executable jar file for a terminal game that can be opened by typing java -jar name.jar in the Terminal. Then I made a .sh file inside the same fol

How to append json array using jq+shell in a loop?

I can create a json object with an array using jq like this echo '{"input":{"names":[]}}' | jq --arg val "alice" '.input.names[0] += $val'| jq --arg val "bob"

Extract string between combination of words and characters [duplicate]

I would like to keep the strings between (FROM and as), and (From and newline character). Input: FROM some_registry as registry1 FROM another_

How can I change the order of some string in a filename

I have lots of files like these: tf_CVBV6Z_CVSA1Z_pws2_pcc1.sac tf_CVBV5Z_CVSA2Z_pws2_pcc1.sac tf_CVBV4Z_CVSA3Z_pws2_pcc1.sac tf_CVBV3Z_CVSA4Z_pws2_pcc1.sac tf

Replace same occurrence of word with different words using sed

I want to replace 2 same words in file(app.properties) with 2 different words using sed command. Example: mysql.host=<<CHANGE_ME>> mysql.username=te

Combining mapfile, command redirection and exit status retrieval

I am reading a build command as so: mapfile -t make_out < <(2>&1 ./make.sh my_program) I would like to print the output kept in make_out only if t

ignoring specific exit code in bash

Note: Question does not duplicate Ignoring specific errors in a shell script . Suppose it is needed to capture the leading characters of a encoded representati

How to overwrite a multiline string in bash?

I have this code snippet, which allows to overwrite a string in bash if used multiple times: echo -ne "String 1 \r" echo -ne "String 2 \r" Output: String 2

How to find the location of a bash file?

I've made an executable .jar file for a terminal game I've been working on. So far, I opened it by typing java -jar name.jar in the Terminal. This worked, but w

Can't Run Go Bin In Terminal

I have been executing my Golang code on Visual Studio in the terminal for the past few weeks. All of a sudden I am trying to run a program I made, and it does n

Can't Run Go Bin In Terminal

I have been executing my Golang code on Visual Studio in the terminal for the past few weeks. All of a sudden I am trying to run a program I made, and it does n

How to be explicit about intentional word splitting?

I'm running shellcheck on my scripts and often get this warning (which in this case is correct, because cd foo bar baz makes no sense): cd ${SOME_DIR} || exit 1

How can I loop with all the nc -zv connections?

I am trying to write a script to monitor all the server ports. But I am able write to for only one connection at a time. How can I write it for all the connecti

Bash completion scripting - getting a "transparent proxy"-like behaviour

I am trying to write a simple Bash completion script for a program that runs its arguments as a command. A good example of this is kind of program is the prime-

Counting lines of code in a Django project

I use this shell script to count the lines of code in a Django project, find . -name "*.py" -type f -exec grep . {} \; | wc -l How can I modify this to not c

How to convert a json response into yaml in bash

I read data from a json file with jq. I wanna append the results into a yaml file, but I dont get it working. I am quite new to shell programming. My goal is to

Execute bash script from Python on Windows

I am trying to write a python script that will execute a bash script I have on my Windows machine. Up until now I have been using the Cygwin terminal so executi

rename files with changing pattern

i want to rename different files in bash with pattern and found this option: rename 's/.2007/(2007)/g' *.* with this pattern I can rename every file with "