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

learn more… | top users | synonyms

0
votes
2answers
65 views

Parse out specific parameter from python script

I have a chage output that I formatted myself called accounts. It basically has the name of the user listed as a section and then the information below it (which are the parameters). I would like to ...
4
votes
1answer
169 views

Logging into hotel Wi-Fi changes bash prompt? [duplicate]

Since clicking on the “I agree” pop-up when logging into a hotel Wi-Fi, my bash prompt contains some kind of hash in it. The format is now: <strange hash>:<working dir> <username> ...
0
votes
1answer
37 views

Spell check in the Bash CLI

Is there any way to do a spell check on the Bash CLI? I tried doing Ctrl-X Ctrl-E to edit the command in VIM but for some reason I could not set set sp in that VIM session. I'm using Kubuntu 14.04.
0
votes
3answers
24 views

Allowing another user to execute program?

I want to allow a particular user to execute a compiled program in my directory. I got his username from cat /etc/passwd. The executable does not write any file but reads a few and gives output on the ...
1
vote
1answer
102 views

How to include environment variable in bash line CURL?

Trying to get Transmission to notify when download complete. This works: curl -u <my-api-token>: \ -X POST https://api.pushbullet.com/v2/pushes \ --header 'Content-Type: application/json' ...
0
votes
1answer
65 views

Bash scripts executed together don't kill background processes

I have a number of shell scripts that work very similarly to this question. Each script fires up a few background tasks, remembers their PIDs with $!, does some testing, and then kills the background ...
2
votes
1answer
76 views

How to check variable returned from MySQL in bash?

I need to run a stored procedure using MySQL from bash. The stored procedure returns a variable and I need to check the value of the variable in bash to display it accordingly. If I echo the variable ...
0
votes
0answers
14 views

How can I get the current song of a shoutcast server?

I have a Shoutcast radio station and I want to get the current song and artist into my bash script. What's the best way to do that?
0
votes
1answer
32 views

How to zip a list of files in Linux

I have many files I need to zip into a single directory. I don't want to zip all the files in the directory, but only ones matching a certain query. I did grep abc file-* > out.txt to make a ...
0
votes
0answers
12 views

How to enable windows-style cntrl+backspace in msysgit (git bash)?

I would like to configure my msysgit environment to use windows-style backspace shortcuts, i.e. cntrl+backspace deletes a word. I found this ...
1
vote
2answers
22 views

Can we use regex in alias command?

I want to create the alias for this command. ssh user@ip as alias [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9][0-9] ="ssh user@$0" I have created it ,but it is not working. Is there ...
1
vote
1answer
29 views

Proper syntax for escaping a `$` in a regex in a bash shell script/makefile?

I'm running a Makefile which includes the following line... find ./ -type f -regextype emacs -regex ".*tests$" | xargs rm -f and am getting an error: find ./ -type f -regextype emacs -regex ...
1
vote
2answers
64 views

Disable numlock, preserving mouse button key bindings

I'm having trouble to disable the Numlock key (make the key do nothing, so that the numpad numbers always work) while at the same time mapping extra mouse buttons (at the side of my mouse) to ...
4
votes
2answers
233 views

Unable to launch application in tmux

I get this error when I try to launch Sublime Text or SourceTree from tmux: $ subl Unable to launch Sublime Text 2 $ stree Unable to open SourceTree It seems that I can't open os x apps either: $ ...
1
vote
1answer
35 views

Possible to get a bash script to accept input from terminal if its stdin has been redirected?

Say I've got a bash script: #!/bin/bash read -p "Gimme some stuff: " stuff echo "**${stuff}**" If the script is invoked with something piping into it, such as: echo "Here's some stuff" | ...
0
votes
2answers
43 views

ascii value in bash/awk

i have a doubt, i know that with this command, it prints the value of a character based on the Ascii table: printf "%d\n" "'a" ##prints 97 But i wonder how can i make my programm show me the ascii ...
0
votes
1answer
19 views

what should i worry about when using mktemp --dry-run

I've been trying to make a temporary named fifo and after referencing Bash: create anonymous fifo I see they are using mktemp -u to get the file name for the fifo. The man page states this is unsafe. ...
1
vote
1answer
9 views

Homebrew script to reinstall formulas

I'd like to develop a bash script to capture the currently installed Homebrew formula, then be able to reinstall these formulas in the event that I need to reinstall my OS. I'm hoping to combine ...
1
vote
1answer
35 views

Using grep, sed or awk to find words in between? I want to be able to extract the package name until .el7

I am writing a script (bash/command-line) and I want to be able to extract the package name until .el7 x=dbus-sharp (an example package name - which changes) example text file: Building ...
1
vote
2answers
53 views

How to kill a continuous process started from rc.local?

I'm working on a Raspberry Pi with Raspbian (Debian-based) OS. For testing I added such a command in /etc/rc.local: python /home/pi/test.py It works fine starting this script. But the problem is ...
0
votes
1answer
89 views

Getting xargs: unterminated quote when trying to find text in files

I'm using Mac 10.9.5 with bash shell. I'm trying to search for instances of text within a group of files, but for some reason, in one particular directory, I get this bizarre "Unterminated quote" ...
0
votes
2answers
50 views

Why do I add a path to ~/.bash_profile and source it, but there's no effect?

In my install.sh: # other commands to install java... echo 'export JAVA_HOME="/usr/java/latest"' >> ~/.bash_profile source ~/.bash_profile After this script runs, I type echo $JAVA_HOME, but ...
0
votes
1answer
31 views

Where do the variables of a new BASH shell come from?

I am puzzled as about how environment variables work. From what I am aware, for a new process to have some environment variables, its parent must have issued export. But what about all the variables ...
2
votes
1answer
26 views

What are the rsync equivalent command/s to mv /a/b /c/d?

What are the rsync equivalent command/s to mv /a/b/ /c/d/, i.e, to move a directory tree from one location to another, possibly on another file system? That is, not just copy, but delete the files ...
2
votes
1answer
95 views

How to force wget to output a summary?

I have a bash script that launches a series of wget commands and log the output. I use the following options: wget --no-verbose --page-requisites --adjust-extension --convert-links --backup-converted ...
2
votes
1answer
22 views

Unset bash variables referring to non-existent directories

I have a file which is sourced by an application, adding relevant directories to $PATH and $LD_LIBRARY_PATH. This is fine, but it results in somewhat excessive pollution of the $PATH and ...
0
votes
2answers
68 views

How to check if busybox has a command?

In my case, I want to see if busybox has "md5sum" builtin. I am currently doing this: $ echo | busybox md5sum &>/dev/null && echo yes || echo no I have not been able to find any ...
0
votes
1answer
34 views

What could cause HostName in command line to display differently?

I am on OSX, and my host name in the preferences panel reads "User's Computer Name" but when I go to my command line it is reading: something else:~ myusername$ My understanding is the first part of ...
1
vote
2answers
53 views

Get SSH one-liner commands to show color

I'd like to enable colored text output on SSH one-liner commands, but I can't seem to get it to work on OS X, Ubuntu 14.10, or OpenSUSE 12.2. If I ssh into a server and type, say, ls --color=auto in ...
0
votes
1answer
14 views

Release control from init.d script centos

I am using logstash-forwarder and starting it inside its init script with the command: /opt/logstash-forwarder/bin/logstash-forwarder -config=/etc/logstash-forwarder -spool-size 100 This command ...
0
votes
1answer
56 views

Prompt yes or no to repeat a command in a bash script

I've attempted using "while" and "ask" without success but the whole goal of this script is to run a command or commands and then ask if you want to repeat the command again. Example: echo "adding a ...
0
votes
1answer
47 views

Centos How to give permission to view folder ?

I push all the local files to Google Compute Engine using gcloud compute copy-files then login to VM using gcloud compute --project and view the uploaded file using ls command it's there .. No ...
2
votes
2answers
51 views

Warning for rm -r command

I want rm to prompt me when recursively deleting a directory, as in: $ rm -r <dir> Do you want to remove the dir(Y/N)? Is there an argument I can pass to rm that will do this?
0
votes
3answers
70 views

remove rm command not working with wildcards on Mac OS X

I am trying to remove the below file for all user accounts through a bash script but the wildcard * does not seem to work. I have been testing the script locally by running it on mac os x terminal. ...
1
vote
1answer
21 views

Display the PID with bash scripting

Good day all, I am trying to write a bash script to show all processes of java, however i would like it to display in the below manner. ps -p $PID -o pid,vsz=MEMORY -o user,group=GROUP -o ...
1
vote
1answer
23 views

Evaluating false in bash with multiple commands without a subshell

Bash evaluates the logical operators such that && always takes precedence. So for example: false || echo 1 && echo 2 1 2 and true || echo 1 && echo 2 2 Ok. So lets say I ...
0
votes
2answers
23 views

Can gnu diff recursively compare only filenames in different folder structures?

I know that I can recursively compare two dirs with diff -qr and output only the differences. However, this appears to compare file positions within the trees (for example, /a/b/file01 != ...
0
votes
2answers
51 views

Executing Commands In Parallel That Never Finish

I'm attempting to run a few commands that never finish. These commands watch a directory and update files when they change. The idea is that I need multiple folders watched by different tools, able ...
0
votes
1answer
18 views

How to get bash history of already running session?

How to get bash history of already running session? 1.) I was thrown out of my server because of a cable fault. 2.) I logged in again using a new session. History of the other session is not ...
1
vote
2answers
26 views

Split multiple gz compressed files into even more files

I have a directory full of gz files. I need to split them into smaller ones, e.g. 1M of size. I do e.g. for one file: $ split --bytes=1m one_unzipped_file prefix_ but how to achieve for many ...
0
votes
2answers
98 views

Bash script that calls a program with some asterisks in arguments

I’ve spent last hour or so trying to write a pretty simple bash script and I never felt so dumb. So I have a list of strings (which are package selector specifications for a package manager, if that ...
1
vote
3answers
38 views

Copying multiple files on linux

I have a linux machine with folders named numerically. How can I securely copy ranges of these folders to another server? The source machine runs tcsh, the target bash. At the moment, from the ...
1
vote
1answer
32 views

Using the mv command with multiple wild cards

I'm still relatively new to Linux, so take it easy on a noob, eh? I have scripts set up to move media files to a specific directory based on its name. I used a wildcard to accomplish this, but I need ...
2
votes
2answers
28 views

Look around bash command history match

I got a match for Ctrl+R In bash. How do I go back and forth around that position? I have several commands that are run in sequence but I forget some of the commands names. Thank you!
0
votes
1answer
31 views

Passing different set of arguments to the different commands in a linux bash script

I am writing a bash script foo.sh that runs too commands bar with first input argument, and baz with the second argument: #! /bin/bash bar "$1" baz "$2" Now I want to make foo.sh more flexible, ...
1
vote
5answers
97 views

How to copy hidden (starting with a dot) files and subdirectories in linux?

How to copy hidden files and hidden subdirectories (the ones starting with a dot) in folder A to folder B? For example if I have this structure: A/a A/b A/.a A/.b/ A/.b/somefile A/.b/.c I would ...
0
votes
2answers
159 views

Update a sqlite database while select into a while loop

There is a bash script that will do "some magic"™ to files which will be referenced to a sqlite database and after doing "some magic"™ the database should be updated. Here are the simplified code ...
0
votes
1answer
69 views

sudo cp with wildcard syntax doesn't do anything in Linux

I have a directory containing files that are owned by root, from this directory I wish to copy all the files ending with errorAll to another directory. My wildcard syntax is correct because performing ...
0
votes
1answer
19 views

Keep screen running after starting it with an alias and running some commands

I have a bash alias to move into a project folder, start screen, and pull new changes from git. it looks like this: alias start_manager2='cd ~/programming/manager2/ && screen -t "main" ...
1
vote
1answer
60 views

How to use linux bash “sort” command in a portable script?

I am writing a bash script and I want to make it portable, to have the same results in the other computers. From this question I learned the system settings, like language settings and possibly other ...