how to transfer data between local and remote server connected via intermediate server?

Bash
I can login by ssh -X servA from local, then ssh -X servB from servA To copy data from local to servB, I scp files from local to servA, then from ser...
1 year ago

Check input argument in a Bash shell script

Bash
I need to check the existence of an input argument. I have the following script: if [ "$1" -gt "-1" ] then echo hi fi I get [: : integer express...
1 year ago

Bash script execution with and without shebang in Linux and BSD

Bash
How and who determines what executes when a Bash-like script is executed as a binary without a shebang? I guess that running a normal script with she...
1 year ago

Why does my bash function handle arguments as a string?

Bash
I am attempting to gather my ip address and subnet bits (such as 192.168.2.17/24) to pass to fing along with a name to scan a network and create a set...
1 year ago

Bash command line and input limit

Bash
Is there some sort of character limit imposed in bash (or other shells) for how long an input can be? If so, what is that character limit? I.e. Is it...
1 year ago

What's wrong with vCard=$(echo $REPLY | cut -d'i' -f 1)

Bash
when I test the code below, I got an error said : syntax error near unexpected token `)' Here is the code: oVideos=$Videos Videos="Please select a...
1 year ago

how to use sed to remove last n lines of a file

Bash
I want to remove some n lines from the end of a file. Can this be done using sed ? Google didn't help. For example, to remove lines from 2 to 4, i ...
1 year ago

How to escape & in scp

Bash
Yes, I do realize it has been asked a thousand of times how to escape spaces in scp, but I fail to do that with the &-sign, so if that sign is par...
1 year ago

OSX messed up PATH

Bash
I was trying to make Sublime editor work from Terminal following this guide and by doing so I modified the .bash_profile file and apparently my PATH. ...
1 year ago

Sending a mail from a linux shell script

Bash
I want to send an email from a Linux Shell script. What is the standard command to do this and do I need to set up any special server names?
1 year ago

How to search multi line string with order in shell script?

Bash
I have a file containing a list of strings, for example: abc search1 lkj sdfdgs search2 kkd #search3 search3 How can I keep all lines matching sear...
1 year ago

Check if a program exists from a Bash script

Bash
How would I validate that a program exists? Which would then either return an error and exit or continue with the script? It seems like it should be...
1 year ago

Check if pull needed in Git

Bash
How do I check whether the remote repository has changed and I need to pull? Now I use this simple script: git pull --dry-run | grep -q -v 'Already ...
1 year ago

How to check if a variable is set in Bash?

Bash
How do I know if a variable is set in Bash? For example, how do I check if the user gave the first parameter to a function? function a { ?? if $...
1 year ago

Shell: get time and date of YYYY-MM-DDThh-mm-ss-{miliseconds}Z format

Bash
I would like to get date and time of format: 2015-11-10T13:26:40.626Z Which command should I use? ...
1 year ago

How to produce a flatfile (?) from a hierarchical csv

Bash
I need to do some data processing on a csv whose structure is as follows: I need to collapse all the data from the TEXT column for rows where the F...
1 year ago

Bash - Update terminal title by running a second command

Bash
On my terminal in Ubuntu, I often run programs which keep running for a long time. And since there are a lot of these programs, I keep forgetting whic...
1 year ago

Using Regex to replace or append line in file | Linux Shell script

Bash
I am trying to find the proper command to execute on a file that looks something like this: (ie .cshrc files) setenv BLAH foo I need the command to...
1 year ago

how to use awk command to cut field?

Bash
there is a file ,which you can get by command ps aux in linux. USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root ...
1 year ago

Redirecting of the output of a command to sed fails, by returning an empty string when assigned to a var - Bash Shell

Bash
new to Shell scripting here and got stuck in a situation which many of you might think silly but here goes :-) I have this snmpwalk command which I w...
1 year ago