How to assign a variable inside if condition in shell script

Bash
I would like to know how to assign a variable inside if block in shell script.. Below is my code.. if [[ -z "$MMBOX_PATH" || -z "$BACKUP_PATH" || -z...
1 year ago

Encrypting large files with public key

Bash
I'm using a shell call which works with small files but not with large (>4GB) ones. openssl smime -aes-256-cbc -encrypt -in INPUT_FILE_NAME -binary -...
1 year ago

How can I output null-terminated strings in Awk?

Bash
I'm working on a shell script that will be used by others, and may ingest suspect strings. It's based around awk, so as a basic resiliency measure, I ...
1 year ago

What's the Android ADB shell "dumpsys" tool and what are its benefits?

Bash
I'm looking for the full list of ADB shell dumpsys commands with a full explanation of all of the commands. Where can I find this information? ...
1 year ago

Finding most changed files in Git

Bash
How can I show files in Git which change most often?
1 year ago

Send a ping to each IP on a subnet

Bash
Is there a command line based way to send pings to each computer in a subnet? Like for(int i = 1; i < 254; i++) ping(192.168.1.i); to enforc...
1 year ago

How to schedule a task wether the user is logged on or not in PowerShell?

Bash
I have a problem regarding how to make a scheduled task to run whether the user is logged on or not. It must be done in powershell. What i have done i...
1 year ago

Keeping grep output in a shell variable

Bash
I am coding a shell script, where I want to get file last 24 hour file changes of a directory. I am doing it like below:for myfile in $(find . -maxdep...
1 year ago

How to enable python repl autocomplete and still allow new line tabs

Bash
I currently have the following in ~/.pythonrc to enable auto completion in the python repl:# Autocompletionimport rlcompleter, readlinereadline.parse_...
1 year ago

Calculating averages over ranges of patterns

Bash
I am very new to this kind of work so bear with me please :) I am trying to calculate means over ranges of patterns. E.g. I have two files which are t...
1 year ago

Can a shell script set environment variables of the calling shell?

Bash
I'm trying to write a shell script that, when run, will set some environment variables that will stay set in the caller's shell.setenv FOO fooin csh/t...
1 year ago

Executing a shell script inside a jar file. How to extract?

Bash
I am developing a Linux-only Java application, and I need to execute a shell script in it. According to what I have read, the only way to execute that...
1 year ago

Print regexp matches in AWK

Bash
Is there a way to print a regexp match (but only the matching string) with AWK?
1 year ago

In UNIX shell scripting: What does $! expand to?

Bash
What is the meaning for $! in shell or shell scripting? I am trying to understand a script which has the something like the following.local@usr> a=...
1 year ago

Copy a row from multiple files and paste as column in a new file

Bash
I have few files as:ifile1.txt ifile2.txt ifile3.txt3 5 2 2 1 2 1 3 4 3 4 1 1 4 2 1 1 3 0 2 5 3 1...
1 year ago

Solve a puzzle using bash tools such as grep

Bash
I need to solve a puzzle using shell script. I tried to combine grep with rev and saved the output into a temporary text file but still don't know how...
1 year ago

ANSI Coloring in Compilation Mode

Bash
Have anyone added support for ansi-color in compilation-mode Emacs? If so what property/attribute does the color-writing program have to check for in ...
1 year ago

How to interactively expand a bang command in bash?

Bash
Shells like zsh and bash have bang commands which start with an exclamation mark and expand to items in the user's history.To get the last argument of...
1 year ago

How to evaluate http response codes from bash/shell script?

Bash
I have the feeling that I'm missing the obvious, but have not succeeded with man [curl|wget] or google ("http" makes such a bad search term). I'm look...
1 year ago

How do i put a string and user input into a new string using strcpy?

Bash
Sorry if the title is a little bit confusing but basically im trying to make a command that will change the default shell of a user. The user just n...
1 year ago