Tagged Questions

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

learn more… | top users | synonyms

2
votes
0answers
48 views

Strange issue with upgrading bash in Yosemite using Homebrew

I'm running OS X Yosemite. I need to use associative arrays in bash so I decided to use Homebrew to upgrade bash to 4.x. I performed the following steps: brew install bash I then added ...
0
votes
0answers
25 views

linux bash/terminal emulator: key “q” not work

i am on debian, Xfce desktop env. When i press the "q" Key, there is no output on the terminal emulator screen/ bash standard output. The capital "Q" works. In vim the "q" works like every other ...
0
votes
0answers
8 views

Tab complete setsid

I regularly use setsid to open a program as a separate process, however it doesn't use tab completion so I end up writing the full program name. Is it possible to add tab completion to setsid? Has to ...
0
votes
1answer
17 views

How to remove characters in the middle of a string in bash

In bash I have a string, and I'm trying to remove a character in the middle of the string. I know we can remove characters from the beginning or the end of a string like this: myVar='YES' ...
0
votes
2answers
60 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
162 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
28 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
21 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
33 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
53 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
61 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
7 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
24 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
9 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
21 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
21 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
46 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
0answers
149 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
22 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
31 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
11 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
6 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
17 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
35 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
32 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
48 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
25 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
24 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 ...
0
votes
0answers
67 views
+100

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 ...
0
votes
0answers
39 views

I accidentally deleted files of root folder

Now my root folder is looking empty.And I lost my shell string (same as: I accidentally deleted my /root folder and now my shell string is different. What gives?) What should I do now ? I created ...
2
votes
1answer
21 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
58 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
32 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
28 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
10 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
31 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
25 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
47 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
52 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
19 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
20 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
34 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
16 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
22 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
84 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
35 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
27 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!
-1
votes
0answers
25 views

what's the difference between export and env_export?

What's the difference between export variable=value and env_export variable value?