Get specific value of preprocessor macro

Bash
In my build settings i have define some preprocessor macros i.e. SANDBOX_ENV=1 I want to use the value of SANDBOX_ENV in my shell script. I have ...
1 year ago

Which characters need to be escaped in Bash? How do we know it?

Bash
Is there any comprehensive list of characters that need to be escaped in Bash? Can it be checked just with sed? In particular, I was checking whether...
1 year ago

How can I use inverse or negative wildcards when pattern matching in a unix/linux shell?

Bash
Say I want to copy the contents of a directory excluding files and folders whose names contain the word 'Music'. cp [exclude-matches] *Music* /target...
1 year ago

Accessing bash completions for specific commands programmatically

Bash
I'm trying to write a small command launcher application, and would like to use bash's tab completions in my own completion system. I've been able to ...
1 year ago

Android display offset/change position

Bash
Is it possible to offset the entire display content / change its position using adb shell? As i recently noticed it is possible to change the resolut...
1 year ago

how to create AppleScript app to run a set of terminal commands

Bash
How would I go about creating an AppleScript command that when I just run the script (or double click it in Finder?), it would run a set of terminal c...
1 year ago

not able to assign variable data to echo

Bash
MY code: $test =$(ps -ef |grep -c "java") echo "$test" it's giving me error: root@test:~# ./restart.sh ./restart.sh: line 1: =4: command not fou...
1 year ago

shell script not executing completely from java

Bash
I have a shell script which does sql build job. when it was called manually from unix prompt it is executing and giving results as expected. but whe...
1 year ago

Running scripts without dot slash (Ubuntu vs Mac)

Bash
In ubuntu scripts can be executed with following commands: $ chmod +x manage.py $ manage.py However in mac you need to use ./ in order to actually ...
1 year ago

Shell script for searching a string and store it in a file

Bash
I have a JSON response file of JIRA issues. I need to extract the JIRA issue key from it and store it in a variable. Below is the sample response file...
1 year ago

Which shell should be used for Linux/MacOS/UNIX best compatibility?

Bash
My question may seem related to SO question "What Linux shell should I use?", but my problem is to know which shell shall be used to write an applicat...
1 year ago

Error using arrays in shell script

Bash
I was testing a shell script in which arrays were used. This is an example taken from tutorialspoint #!/bin/sh NAME[0]="Zara" NAME[1]="Qadir" NAME[2...
1 year ago

How can a bash script restart a process on non-0 exit while sending signals to child

Bash
Following this question: How do I write a bash script to restart a process if it dies? I am trying to make a bash script which simply runs a python s...
1 year ago

Unix Shell String appending to delete file

Bash
I am writing a script to delete a log file from a specific location. I would pass a directory and filename as a parameter to function. This function w...
1 year ago

How to kill zombie process

Bash
I launched my program in the foreground (a daemon program), and then I killed it with kill -9, but I get a zombie remaining and I m not able to kill i...
1 year ago

Creating a new user and password with Ansible

Bash
I have an ansible task which creates a new user on ubuntu 12.04; - name: Add deployment user action: user name=deployer password=mypassword it ...
1 year ago

timestamp=$(date +%Y%m%d) not evaluated in shell script

Bash
I have a shell script that calls another shell script. One of the parameters is the output filename which I want to prefix with a timestamp. So far I'...
1 year ago

Copy and create a directory with date timestamp where it does not exist

Bash
Background: I have a Jenkins task that is executing and before running i want to take a copy of a folder and move it to another directory which does ...
1 year ago

How to insert a newline in front of a pattern?

Bash
Not how to insert a newline before a line. This is asking how to insert a newline before a pattern within a line. For example, sed 's/regexp/&\n...
1 year ago

Exiting a shell script with an error

Bash
basically I have written a shell script for a homework assignment that works fine however I am having issues with exiting. Essentially the script read...
1 year ago