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

learn more… | top users | synonyms

0
votes
0answers
16 views

What is the alt+~ hotkey on the bash terminal?

I was switching between windows today (alt+`) and had my finger on shift as well it seems - this popped up in my terminal, avahi user mysql ...
0
votes
0answers
15 views

How to rerun a program if word `error` is detected on STDERR?

I am using a compiler that is pretty moody. Sometime it crashes for an unknown reason. Inside my Makefile I would like to rerun the build in case of an error. So far I wrote this: TRY=3 until [ ...
2
votes
0answers
22 views

Program options have sometime one or two dashes (-foo, --foo) [duplicate]

In gcc every command line arguments have one dash. In some other tools, options that are not a single character have a two dashes prefix. Why is there two standards, which one is the most common? ...
1
vote
2answers
28 views

understanding tilda,slash command in bash

I have confusion in the meaning of command ~/ if x is a directory, then what is the meaning of ~/x in bash. Please guide me
1
vote
0answers
16 views

Sourcing .bashrc does not enable use of nvm

I'm trying to set up a shell script to run in the context of a user account after the creation of a virtual machine using vagrant; I am a windows user so I've limited exposure to bash scripting. I'm ...
0
votes
1answer
11 views

ssh session stuck after some time of idleness

I'm using fedora 19 and bash 4.2.53(1)-release If I leave an ssh connection opened for some minutes and don't do anything with it, the terminal get stuck. Here's netstat's output: tcp 0 ...
2
votes
1answer
39 views

Function using watch on command with command line arguments

I want to run watch on a command which uses an optional command line argument, like this: function queue() { watch -n 10 'squeue -p ${1:-default} -o "%.8i" ' } but the command-line argument ...
0
votes
1answer
24 views

how write in script bash: su - user, command, password, without ask me password? [duplicate]

i will create file sh (bash script) #!/bin/bash su - username -c XXXXXXXX xxxxxx= command where i put my password?( but NOT ask me password in terminal..how?)
0
votes
3answers
51 views

Linux - Avoid cat: no such file or directory when file does not exist

I am checking via a bash script whether a process is running based on the PID stored in a file. I get the error shown above when the file does not exist as the command is trying to access the file and ...
0
votes
0answers
7 views

Vimperator — Custom ExtendedHit to launch script/program on matching regex

I want to define a custom extendedhint in vimperator that: Matches a regex pattern Feeds that match to a script as such: ~/bin/script regex-match-as-arg Where should I start solving this problem? ...
0
votes
1answer
36 views

Accidental recursive cp -R, now can't delete file using either Trash or rm

After a mistype in a path when using cp, I seem to have accidentally copied the folder in to itself recursively, and now I can't delete that folder using rm -rf, or the Trash in Mac OS X Finder. The ...
-1
votes
2answers
31 views

Only show part of logfile in bash script

OpenVPN log looks like this: OpenVPN CLIENT LIST Updated,Sat Jun 20 04:20:07 2015 Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since [ A .... ] ROUTING TABLE Virtual Address,Common ...
-1
votes
0answers
21 views

bash does not recognize syntax or filetype command from .vimrc on Mac 10.10.3

I am running OS 10.10.3, and when I add syntax on or filetype plugin indent on into my ~/.vimrc, i get: [ross@RossMac pic]$ source ~/.vimrc -bash: filetype: command not found -bash: syntax: ...
0
votes
1answer
30 views

SLURM allows jobs using more CPUs than requested to start

The problem I am facing with SLURM can be summarized as follows. Consider a bash script test.sh that requests 8 CPUs but actually starts a job using 10 CPUs: #!/bin/sh #SBATCH --ntasks=8 stress -c 10 ...
0
votes
2answers
21 views

Reference shortcut

I am new to OSX/linux. I have all my development stuff in the following location: ~/Dropbox/Dev/CompanyA Is there anyway I can create a link to that folder by just referencing ~/dev or something? I ...
0
votes
1answer
25 views

How to autocomplete filenames with “wordwise” camelcase matching in bash?

While programming using QtCreator, I got used to its camelcase-aware completion, e.g. typing MC<ctrl-space> would offer MyClass as a completion option. Now I am basically annoyed about that ...
0
votes
1answer
25 views

need to get average idle time using mpstat

I want to get average idle time of the server using mpstat. The problem I am having is %idle is not in same columns in all the versions of linux. example 1: [root@testserver ~]# mpstat 1 2 Linux ...
1
vote
2answers
29 views

Can xargs evaluate $HOME?

When I type in echo $HOME/Downloads | xargs cd It correctly changes directory to $HOME/Downloads. Maybe that is because echo evaluates $HOME before piping to xargs. However if I type echo ...
0
votes
0answers
32 views

Why “ls” command highlights some folders?

Why LS highlights folder PyFac ? How disable this highlighting? IMG My .profile: if [ -f $(brew --prefix)/etc/bash_completion ]; then . $(brew --prefix)/etc/bash_completion fi export CLICOLOR=1 ...
4
votes
1answer
39 views

What does chmod 7760 <directory> do in CentOS 7 bash?

I typed the command chmod 7760 by accident. I meant to type chmod 770 and now I'm curious what the first command did exactly. After typing chmod 7760 , I typed ls -Al and the directory name was ...
1
vote
0answers
26 views

executing script on remote host by ssh

I wrote a script test.sh (its function is the same as "hostname" command) as below, #!/bin/bash printf "`uname -a | awk '{print $2;}'` " I can get my hostname with source /home/arton/test.sh or ...
1
vote
0answers
20 views

Issue installing Java EE 7 SDK update 1

I've installed Java (jdk 1.8) and set JAVA_HOME, now I'm trying to install Java EE 7 SDK which I downloaded it from here. The Oracle download page shows Universal Zip Installer type file, downloaded ...
3
votes
2answers
54 views

How can I restructure this line of bash code so that I can comment on each instruction?

I have a line of bash: SAMPLES=$(for f in `find $IN -iname *fastq.gz `; do basename $f | cut -c 1-4; done | sort | uniq) which I am attempting to break up into multiple line for the purpose of ...
1
vote
1answer
27 views

Aliasing piping operations in bash

I frequently will do something like grep -R foo . at the root of a project. It’s helpful but the results get diluted by the inclusion of binary. temp, and test files that I don’t care about. So I end ...
1
vote
1answer
23 views

libtool installed but not found in /usr/bin

I have to compile a program (not made by myself) and in his autogen.sh there is a script command that search libtool LIBTOOL=$(which libtool) but the command don't find the command. I see the path ...
1
vote
1answer
11 views

Monitor SSH login's via slack but hangs on SCP

I'm playing around with some slack integration so that every SSH attempt gets sent to a slack channel The script below works perfectly for SSH attempts but the issue is that when I preform a SCP to ...
0
votes
1answer
24 views

How to delete folder and files in the destination that are missing in the source (before copying)?

I sometimes have the problem that rsync tries to transfer a new file from the source to the destination (both have the same space) when there's already not enough space left, which causes this error ...
0
votes
2answers
44 views

How can I find all files that contain a string and then replace these files with another?

I want to replace all files (foo.php as example) that contain certain string 'bar' with a backup foo.php file, which is located in ./backup/foo.php. How can I do that? I know if I grep -lrI foo . all ...
0
votes
2answers
25 views

How to get Syslog Referer URL

I have two urls one.example.com and two.example.com, is there a way in the syslog conf of capturing which URL was used to hit the server? I need to modify a database filed based on this information. ...
2
votes
1answer
20 views

Appending a unique identifier to bash commands

I'm running a command, and I'd like to be able to use pkill -f to kill that specific command instance later. There's no reasonable way for me to get the PID. So, my idea was instead to append a ...
0
votes
1answer
34 views

Piping a line of the file read with while read loop

I am trying to read each line of the file and then assign some parts of it to variables. A line itself is read as a variable so I need to process a variable input say for cat which seems to be ...
0
votes
0answers
23 views

How to load config file via git?

I suspect this is a silly question, but I haven't been able to find an answer online. I'm trying to load a config file in git, but the file is not in one of the default storage locations. So I tried ...
0
votes
1answer
36 views

In bash script, how to generate a random string

I need to generate many random alphanumeric strings, which also use capital letters. It needs to start with 3 characters (e.g. Dk6) and then, with a while loop, go up to about 9 characters (e.g. ...
0
votes
1answer
35 views

Monitoring changes in file with bash

I'm running DHCP server on local network which calls this script every few seconds: dumpleases | awk '{print $2}' > leasesnow #get list of all IPs leased in a file, one per line ADDED=`awk ...
4
votes
3answers
374 views

messaging.sh: line 29: [: missing `]'

I don't know if this is a bad thing, or what it means. My script still seems to work fine, but should I fix it? #!/bin/sh #This script will send text and maybe images to other computers via ssh and ...
0
votes
1answer
19 views

Sharing variables between applescript and bash script in same script

Is it possible, in a bash script, to have a variable, but also allow applescript (with osascript) to use that variable?
3
votes
1answer
27 views

Linux - Syntax error when issuing command

I get a syntax error when using the following if condition in a bash script. if [ -f $pid_file ] && [ $check_run_proc == *"my_proc"* ] && kill -0 $(cat "$pid_file"); then Can you ...
0
votes
1answer
49 views

Bash Script to generate <name> and pass this as command line argument to programm

I have an python script which gets 1 command line argument python arg Now I want a bash-script which: calls python arg & with the argument arg=000 make this x-times so therefore: python ...
0
votes
0answers
6 views

Error trying to copy files with find and cpio

I have a bash script that I use to periodically make a backup of proofs (PDFs & JPGs) from a server I work on. I put together the script a couple of years ago and it used to work however the ...
-1
votes
0answers
19 views

conEmu 3x3 bash

I want to run a 3x3 bash setup. Since this needed some tweaking I just wanted to share the answer here. Create a new task and add Bash::CygWin 3x3 bash to task name. Then paste the following in the ...
0
votes
3answers
81 views

Does “DOS” have a shell?

I have been reading the posts I found about shell , terminal , bash but I get more and more confused about these terms. Does the operating system DOS have a shell, like the bash in linux? Is this ...
0
votes
2answers
45 views

Apply full vim colorization for bash scripts that have no shebang line

So in my project there are many bash script files that are sourced, but never run directly, so they get no shebang line and no execute bit set. Vim colors them a little bit, but doesn't use the full ...
1
vote
2answers
46 views

Bash process with 100% cpu usage. How to troubleshoot?

I have a bash script that is in a runnable state with 100% cpu usage in the user space. Is there a way I can inspect more closely what's causing the issue, without killing the process, such as do a ...
0
votes
1answer
19 views

script a list of websites to determine ciphers

Have a list of websites I would like to check the ciphers. We will be using SSL decryption and want to see if I can in advance check the sites that will not support our decipher. We have some ...
1
vote
2answers
31 views

Part of terminal line disappears when pressing down arrow

I use a custom PS1 to display more relevant information in my terminal, such as if I'm in a git directory and if it's clean or needs to commit changes. However, sometimes when I'm arrowing through ...
1
vote
2answers
38 views

Completion when pasting Bash command beginning with tabs

I'm writing a Dockerfile which I'm formatting using tabs (which I usually use everywhere). But I've copied a multi-line command where the second line begins with two tab characters, i.e.: apt-get -y ...
1
vote
0answers
23 views

Run bash command from link in browser

Is there a way to run an arbitrary command on OSX by clicking a link in the browser? As you know, there are certain types of hyperlinks that launch certain applications with a specified action, for ...
2
votes
1answer
34 views

cronjob opening then IMMEDIATELY closing ssh tunnel

I'm trying to write a script that would open an SSH tunnel to a public-facing server. I've got everything written and working correctly, but the connection doesn't seem to be making it to my server. ...
0
votes
1answer
34 views

Remove last column values in field seperated file using unix shell script

The files is seperated by | pipe symbol myfile.txt Hello|how|are|you|hope|you|are|doing|fine Lilly|jasmine|rose|sunflower|nightfire|flowers I want to remove columns greater than 3. I want result ...
8
votes
3answers
144 views

How to have a better view when typing out directories in terminal?

I am currently using a Mac and learning to use the terminal, but the question applies to Linux systems as well. I would like to ask, when typing out paths in the terminal/command line, is there a way ...