Bash is a free shell for Unix-like operating systems from the GNU Project.

learn more… | top users | synonyms

0
votes
1answer
23 views

Watch with awk command

How do you watch a command like? awk 'NR%2==0 {printf "%s %8.0f", $1, $5}' filename.txt Preceding this with "watch" gives this error: awk: cmd. line:1: fatal: cannot open file `{printf' for ...
0
votes
1answer
6 views

Bash script to get nested http response from URL

I have a scenario where I am deploying applications to a Tomcat instance using a bash script and need to test if the endpoint (a login screen in this case) is truly available by testing it before I ...
0
votes
4answers
58 views

bash - What does {} means?

I want to delete files, which have size = 0. So I tried: find ./ -size 0 | xargs rm But it has a problem with files, which names begin with space. I found this: find ./ -size 0 -exec rm -i {} \; ...
0
votes
1answer
24 views

What does a question mark after the file name mean using ls terminal command?

What does a question mark after the file name mean using ls terminal command? I am using a Mac running OS X Yosemite (v.10.10.5) When I do ls command at terminal, I get back a list of files (the same ...
0
votes
0answers
23 views

Deleted a Windows folder using Linux command rmdir -rf foldername

I have a folder on a Windows 7 machine with contents in it and decided to delete it using Git Bash, namely with the command rmdir -rf foldername. According to this manual ...
0
votes
0answers
9 views

Bash completion for commands in Cygwin

When using tab completion in Bash on a Cygwin system to complete a command name, the .exe extension is appended to command names. Example: typing opens and pressing Tab completes the command to ...
0
votes
0answers
6 views

issue launching atom via git bash shell

I am trying to launch atom from the git bash command line. Sometimes atom has some sort of an auto-update feature where it upgrades itself. And when that happens, you may notice something on the ...
0
votes
1answer
26 views

Changing my shell bash script default $PWD to it's (the script's) current location

Hey I'm running my shell script that interacts with folders and files, but my $PWD that it keeps pointing to /home/MyUserName directory and this messes with what it is supposed to do. I am running ...
1
vote
0answers
9 views

`qsub` leaves “NotQueued ” in “blocked jobs”

I am working on a remote cluster (westgrid > bugaboo) on which I submit processes via a .pbs file. My .pbs looks like this #!/bin/bash #PBS -l procs=1 #PBS -l walltime=100:00:00 #PBS -N ...
-1
votes
0answers
23 views

An Executable to clean up ram in MAC?

I was searching if I could clean up RAM with terminal and I came across few resources. I found one way it could be done is to use the command sudo purge in the terminal window, but I really don't ...
0
votes
1answer
13 views

Pattern search the user input in a file in Unix using awk

I am trying to write awk script to search for a pattern that is given input by user, in a file. My code look like this: awk 'BEGIN{printf "Enter : ";getline input<"/dev/tty"} /'"$input"'/ {print}' ...
0
votes
0answers
14 views

What is the difference between \e[38;5;175m and \[\e[38;5;175m\] as it relates to bash colors?

I have been trying to learn how to customize my shell and I came across two different ways of specifying colors in the Bash shell. They both seem to accomplish the same goal and I am not sure what (if ...
0
votes
1answer
22 views

Background process with stdOut/StdErr output in files and console

I want to SSH into a machine, start a process, write the stdErr and stdOut of the process into two seperate files while reading the stdOut/stdErr in the console. As soon as some specific lines were ...
0
votes
1answer
18 views

Can we install a package through a shell script? [duplicate]

I'm trying to write a shell script so that when I reinstall my Ubuntu again. I could just run script and retain all the packages. And I'm planning to pass password in form of argument. My question ...
0
votes
0answers
20 views

How to have error output from `ls` if target directory is empty

I'm currently learning how to use the Linux shell, getting to grips with the basic commands like cd, ls and pwd. My file structure is like so: user |-- documents |-- file1.pdf |-- file2.txt ...
0
votes
2answers
24 views

tail/head all line except X last/first Lines

for example i have this file : cat myfile 1 2 3 4 5 i want to print all lines except first 2 line . output should be like this : tail -n $(( $(wc -l myfile | awk '{print $1}') - 2 )) myfile 3 4 5 ...
0
votes
2answers
24 views

why doesn't xterm work with my script?

my script : echo 123456 > /folder/folder/123.txt I ran the script with xterm: xterm -e my.sh & It doesn't work.
0
votes
2answers
10 views

find -exec where filename is not the last parameter

I am trying to pass the files from find command to adb push like this: find . -name "test0[4-8]*.py" -exec adb push {} \; /storage/emulated/0/ I get an error find: paths must precede ...
1
vote
1answer
14 views

Execute SSH port forwarding along with the browser

I've successfully set up dynamic port forwarding over SSH in Pale Moon and added the alias as ssh-forward in .bashrc. Now I have to execute both ssh-forward and palemoon to access the Internet over ...
0
votes
1answer
25 views

How to pipe binary stdout to a compressed tls connection?

Not so long ago, I could use : cat somefile.txt | openssl s_client -connect server:port -quiet -comp However, this command doesn’t work, even with-ign_eof: $ cat somefile.bmp | openssl s_client ...
0
votes
2answers
23 views

From logs, extract specific line after a grep by line number

I have a file, debug.log, from which I want to extract all the lines that immediately precede a specified pattern. Example: 1 blabla 2 blabla 3 HERE THE IMPORTANT THING 4 HERE IT MATCHES MY PATTERN ...
-1
votes
0answers
23 views

monitoring websites using curl [on hold]

I am looking to monitor about 40 (Linux/Apache) urls hosted in a DMZ. I am thinking of using curl from a Linux box in the DMZ to do this and pass the data to a monitoring tool. My plan is to use a ...
0
votes
1answer
6 views

lost virtualenv display to the left of bash prompt

I added thy Holy prompt to display my current branch so I never push to master. We all use it and it works, but I am no-longer seeing what virtualenv I'm using at the moment, which is a hassle. Based ...
3
votes
1answer
30 views

How to pipe AWK command output to Python as first argument

I have a plain text file input.txt which looks like: D000001 D000001 44 1975 D000001 D000408 1 1983 D000001 D000641 1 1977 D000001 D000900 27 1975 I process this file using simple AWK line: awk ...
1
vote
1answer
11 views

grab history command and args for different commands

I have the following exercise: 47 vim wilson.0321 wilson.0329 I need to grab the last command and args to create: vim wilson.0329 right now I can grab the last arg or entire command: ...
1
vote
2answers
63 views
+100

Cygwin paste long line is inserting newline at wrap point

I'm having issues with Cygwin's Copy/Paste functionality on a fresh install. If I scrunch my cygwin window small, and then type a command that is wider than it is (such as echo ...
0
votes
0answers
17 views

How to expand a loop iterating over an array dynamically in BASH?

I need to iterate on an array and expand the array while iterating. How do I do it in BASH? For example: req="a b c d" read -a MODULES <<<$req for MODULE_NAME in "${MODULES[@]}"; do ...
-3
votes
1answer
42 views

What is the use of Bash in the next update for Windows 10? [closed]

In the Build conference this last month, Microsoft said that Bash was going to be introduced in to the anniversary version of Windows 10 in July. And I thought to my self, would this be an advantage ...
1
vote
0answers
11 views

tmux: get names of panes, each current directory and history

my tmux session is a bit broken, by which I mean that tmux ls returns an error like error connecting to /private/var/folders/d0/xbg08_x12lddw3dkht5w462c0000gn/T/tmux-501/default (No such file or ...
1
vote
1answer
16 views

How to pass array to bash shell script?

How do I pass an array as a variable from a first bash shell script to a second script. first.sh #!/bin/bash AR=('foo' 'bar' 'baz' 'bat') sh second.sh "$AR" # foo sh second.sh "${AR[@]}" # foo ...
0
votes
1answer
12 views

Nano does not resize to window size in bash on OS X

Any ideas on how I can fix this? I am not sure what to google for =[
1
vote
1answer
14 views

Accessing array index variable from bash shell script loop

I want to access the array index variable while looping thru an array in my bash shell script. myscript.sh #!/bin/bash AR=('foo' 'bar' 'baz' 'bat') for i in ${AR[*]}; do echo $i done The result ...
0
votes
2answers
25 views

How To Execute /bin Functions From The Python Terminal?

I'm actually running a python interpreter through a Linux bash terminal, and I'd like to be able to execute some of the bash commands in /bin through the python interpreter. How might I do this?
0
votes
1answer
16 views

Run script without typing sh on Android

I wanna run my script which is located in system/bin and permissions is 755. With sh myscript there is no problem but myscipt or ./myscript doesn't work even if the pwd output is /system/bin. On ...
0
votes
0answers
17 views

Bash in Conemu is overlapping lines

When I start nano/vi or a program that normally clears the screen then I can still see the command line. That means that the terminal is not cleared. If I scroll with the arrow keys the lines ...
0
votes
1answer
24 views

Copy Multiple Files w/ Same Extension but Add Date

I want to create a single command that will backup all my *.db files in a directory but I want to append the current date. a.db -> a_2016-04-21.db b.db -> b_2016-04-21.db c.db -> c_2016-04-21.db I ...
0
votes
1answer
11 views

Screen does not read /etc/profile.d on startup

Whenever I start screen, my alias definitions in /etc/profile.d are missing within screen. How can I make screen read/source all files in /etc/profile.d/ on startup?
0
votes
2answers
30 views

Replace backslash(“\”) with forward slash(“/”) in a variable in bash

I want to replace backslash(\) with forward slash(/) in a variable in bash. I tried it like this, but it doesn't work: home_mf = ${home//(\)//(/)} For example, I would like \a\b\c -> /a/b/c
0
votes
1answer
25 views

Running a web server via script at startup

I've got a puma webserver running my dashing dashboard from a linux VM. Currently, the VM starts as soon as my PC starts, but I have to manually run the server. I usually do the following after ...
1
vote
0answers
19 views

Bash traps not executing on last cmd for scripts passed in with -c

Here's an example: $ (newline=$'\n'; bash -c "trap 'trap ERR; echo handler' ERR; set -e;${newline}/bin/false") The handler will execute if I do any of the following: remove the newline trap on ...
1
vote
1answer
39 views

CTRL+R in shell - if I go past the command I want, how do I get back to it?

I'm feverishly hitting CTRL+R to find some command I used awhile ago, when suddenly I get to it. By reflex, I continue hitting CTRL+R, passing it for something further back in the shell history. How ...
0
votes
1answer
18 views

Rename php.ini.default to the more recognizable and standardized php.ini

When I type command: mv /etc/php.ini.default /etc/php.ini I get: bash-3.2# mv /etc/php.ini.default /etc/php.ini mv: ...
0
votes
0answers
12 views

Display scp progress in zenity window

I would like to graphically display the scp transfer progress of several files from a remote server to the local machine. I thought using Zenity for example. Browsing the net I found the command pv ...
0
votes
2answers
276 views

How to run a bash script via absolute path?

I have a file: /Users/danylo.volokh/test/test_bash_script.sh Content is very simple: #!/usr/bin/env bash echo "-- print from script" I'm in folder "danylo.volokh" This command runs fine: ...
0
votes
1answer
15 views

place the MySQL libraries in the correct location

Run the following command to place the MySQL libraries in the correct location: cp /usr/local/mysql/lib/* /usr/local/lib/ and I get bash-3.2# cp /usr/local/mysql/lib/* /usr/local/lib/ cp: ...
1
vote
2answers
25 views

How do I search for substrings in Bash?

I want to find out and display the total amount of TTT substrings found in the first 2,000 lines in the file. I had been using grep until I tested it, and realized it does not identify substrings.
0
votes
2answers
23 views

Pass variable to another pane

I'm working with tmux and I'd like to pass some information from one pane to another. For example in first pane i've got the folder by pwd command and instead of copypast to another pane I want to ...
1
vote
0answers
21 views

way to automate git repositories cloning

I have to clone several repositories on the VM-s and then building software on them. I have pretty nice build script but there is one issue. Before build, several repos should be cloned, and after ...
0
votes
1answer
47 views

curl command not found on OSX El Cap

My understanding is that curl should be installed. I had tried using curl from the Unix command line and got the message it could not be found. I'm wondering If something I did in efforts to clean up ...
0
votes
3answers
26 views

how to pass output of grep to “lsof -p”

I want to know the path of currently running ./a.out There are several MPI process, but I only need one of the PID of several ./a.out. So I first use below code to grep it ps aux|grep -P ...