Addition in awk failing

Bash
I am using following code snippet where I export the shell variables in awk as follows: half_buffer1=$((start_buffer/2)) half_buffer2=$((end_buff...
4 years ago

Dont understand (Pipes) usage unix

Bash
I am studying for 'operational Systems' exams at my uni and i am having hard time understanding pipes usage (|). Here is an example i found on intern...
4 years ago

Changing bash prompt temporarily by own script

Bash
I wanted to write a tiny shell script that shortens the commmand prompt when it gets too long. Setting the PS1 variable in bash works fine. When I try...
4 years ago

Update using rsync and remove from the source folder

Bash
I want to rsync contents from /local/path to server:/remote/path. The files end with extensions composed by 4 digits If a file does not exist in rem...
4 years ago

Bash shell programming echo without jumping to next line

Bash
#!/bin/bash echo "Enter process name" read process if pgrep "$process" > /dev/null then echo 0 $(awk '/Rss/ {print "+", $2}' /proc/`pidof $proc...
4 years ago

How to print the string preceding a specific word in shell?

Bash
I have a string and I want to print all the substrings that end with a specific word in shell, example This is a echo test example echo please help...
4 years ago

How can I display 4 lines above the matched pattern

Bash
Here's the file temp.file Line no1 Line no2 Line no3 Line no4 Line no5 abc I am using less temp.file|grep -i "abc" which prints me the line "abc". ...
4 years ago

Git Checkout Latest Tag

Bash
I'm writing a shell script and I'm looking to checkout the latest version of repo. Specifically I want to break this process apart into multiple steps...
4 years ago

Batch music directory rename script/command for Linux (bash)

Bash
I have a lot of directories which have as name: (YYYY) Artist - Album Some examples: (2009) Vengaboys - Greatest Hits! (2010) AC_DC - Iron Man 2 (20...
4 years ago

How to use bash dialog --yesno correctly

Bash
I want a simple Yes/No dialog and do make an action dependent on the users choice. My try so far: operation=$(dialog --stdout --title "What to do?" \...
4 years ago

Interpreting shell variables in bracket grep

Bash
I have command like this : grep ABC /tmp/dir{1,3,7}/file*.txt It works perfectly fine, but I need extract constant with filename like this: FILENA...
4 years ago

Finding next open port

Bash
Is there any way, using basic Unix commands, to find the next unused port number, starting at port 4444 and going upwards? I'm ssh'ed (via openssh) i...
4 years ago

^H in bash variable

Bash
#!/bin/bash echo "hello^H^H" #hello echo "hello^H^H " #hel o I know ^H deletes back a letter in console. But why the first echo has no effect and...
4 years ago

How to associate .install file extension and PKGBUILD file name with shell scripts in VSCode?

Bash
In Visual Studio Code I have tried to associate *.install (i.e., files with the extension .install) and PKGBUILD files with shell script syntax highli...
4 years ago

Linux: Rename File With Exact Substring

Bash
I have a JAR file that comes with its version number appended in the file name, and I'd like to rename it to something generic in my crontab shell scr...
4 years ago

How to modify a .cmd file to loop through items?

Bash
I found a .cmd file online to do what I want, but it only does one item at a time, so I have to create multiple files to do each item. It looks like ...
4 years ago

How do I use shell script to check if a bucket exists?

Bash
I have aws cli installed. I'm just not sure how to do this in shell script. when I run command aws s3 ls s3://bucket it would give me something like...
4 years ago

Reading from A to B, but stop at the first occurrence of B

Bash
I'm trying to do a shell script that reads from a file from a string A to a B string. The string A I'm sure that is UNIQUE, but the B string is repeat...
4 years ago

Trying to grep instance id from within a text file

Bash
I have a text file bak.txt with the following content: ^[[34mINFO^[[0m[0000] Your engine version 1.11.1-cs1 is compatible ^[[34mINFO^[[0m[0000] We ...
4 years ago

Shell Script split concatenate and re-use

Bash
In Shell script I want to achieve something like below: str="india,uk,us,uae" I want to split it and concatenate each item as below and assign to s...
4 years ago