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

learn more… | top users | synonyms

0
votes
0answers
47 views

automatically prepend variable in for loop without having to put variable on each line

Is there a way to automatically have the $i variable prepended to the beginning of the command without having to specify it each time? Here is my current script. #!/bin/bash for i in "command ...
2
votes
2answers
4k views

How to solve: -bash: : cannot execute binary file

I have a file named b1 that contains assembly language. I am trying to execute the file on OSX using $ ./b1 I get the following error: -bash: ./b1: cannot execute binary file I've looked at ...
1
vote
1answer
47 views

What permissions do I need to give my user to run “shutdown -r 5” command from cron?

I’m have a bash script that I run in /etc/crontab on Linux $ uname -a Linux mymachine.com 3.4.76-65.111.amzn1.x86_64 #1 SMP Tue Jan 14 21:06:49 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux The bash ...
0
votes
1answer
84 views

bash directory name with a space in CDPATH

I'm trying to set a shortcut so that I don't have to type a really long directory name so often. In ~/.bash_profile, I am doing something similar to: export ...
4
votes
2answers
185 views

Ruby commands are turning off tty echo

After running Ruby scripts, almost 100% of the time, the bash command line will appear to be inactive, while in fact it's silently accepting my keystrokes without showing them to me. This has ...
0
votes
2answers
70 views

How to list ALL connected HDD devices in a scrip-friendly way?

How to list ALL connected HDD devices in a script-friendly way? All - means both mounted and not mounted. Script-friendly - means something I can use for (u)mounting in my shell script with minimum ...
0
votes
1answer
191 views

CygWin terminal in remote console (SSH) not starting at correct $HOME path

I have installed CygWin v1.7.28. The problem quickly explained: Basically, when starting a CygWin shell via remote login, the $HOME is not where it should, with all derivated (bad) consequences of ...
0
votes
2answers
87 views

Shell not expanding *

I am setting up a java classpath in a bash script. I thought that I would have to use quotes to prevent shell from expanding the * based on this question: ...
1
vote
1answer
84 views

How to redirect ALL output from a command in Linux

I'm running Gentoo Linux. A program (equery) outputs a massive list of all the currently installed packages (equery list "*"). I want to find out which of them are unstable. Equery marks the unstable ...
1
vote
1answer
314 views

Running a CygWin shell: what windows console (DOS) commands do disappear?

If under my Windows with CygWin (v2.831 32bits) I do: cmd mode 80,50 the screen width changes, but if I open a CygWin terminal, like bash: C:\cygwin\bin\bash --login -i $ mode 80,50 bash: ...
12
votes
5answers
1k views

How do I tell mkdir to try creating dir1, and if it already exists create dir2, etc, until it hits a name that doesn't exist?

I want to create a directory with a number at the end, e.x. "dir1", and increment that number if the directory already exists until it hits a directory name that doesn't exist, and I need to do this ...
1
vote
3answers
64 views

Is the word shell a synonym of process?

From this article: Sourcing will execute the commands in the current shell, executing will create a new shell and execute the commands there. He describes that each shell has its own PID. I ...
0
votes
1answer
152 views

Cassandra Bulk Loader never exits on a null pointer exception, so my calling shell script doesn't see the failure

I created a script that processes files in a loop, using a process call. I check the exit code of said call to see if I should move the files (on success.) Problem is, that when the process fails ...
1
vote
0answers
86 views

Tmux causeing issues with Bash up-arrow

When using tmux, I have issues of ghost characters when using the Up and Down arrow keys in Bash. If I press UpArrow a few times and then press DownArrow a few times, then the first few characters of ...
1
vote
1answer
472 views

How to replace line in file with pattern with sed?

I'm reading a lot of documentation on sed, and am still stumped on my particular use case. I want to replace this line in a conf file with my own line: Replace this line: #maxmemory <bytes> ...
0
votes
1answer
91 views

Two process ids for one terminal in bash linux mint

I am running one bash terminal in linux mint. I wanted to see the process ids of running terminal. So I tried two things: ps -C 'bash' ls -l /proc/*/exe | grep bash Both of this giving two ...
2
votes
1answer
866 views

Using wildcards in scp command

I have a bash script which copies several files to a remote server using scp. This script works fine but now I need to add a file that contains a wildcard in the name and i have a problem with it. ...
0
votes
1answer
37 views

Set ENV variable for all commands in current directory in mac os

Is there a way to run all commands in current directory with some ENV variables predefined? Example of what I need: I put some file, say .env in my directory, with: export SECRET='abcd123' Then I ...
0
votes
2answers
53 views

Zsh: how to auto complete after a command?

everyone. It's a little difficult to explain what I want to do. I want to create a script 'example', which can input long commands for you after you run it with short parameters. For example, $ ...
1
vote
1answer
611 views

Launch multiple programs in background on windows 8.1

I want to start (launch) three programs in windows and all of them in Background i.e. No windows. I found two ways (both using vb script to hide a bat) Set WshShell = ...
0
votes
1answer
35 views

Dynamic diff of one file

I am trying to diff one file over time using process substitution in bash. diff <(cat /path/to/file | sort; sleep 20) <(cat /path/to/file) I also tried: diff <(cat /path/to/file | sort ...
0
votes
0answers
97 views

Error uncompressing file when piping curl to gunzip

I need to download a gzipped xml feed to parse in my Ruby app. It may well be quite large, 30Mb compressed, 300Mb uncompressed. So I do this: curl -s http://example.com/file.xml.gz | gunzip and read ...
0
votes
2answers
198 views

Difference between “ls -lh” & “ls -lh | tail -n +2”

I was going through the split command article on internet and came across this Linux command ls -lh | tail -n +2 for listing files. Is it any better than ls -ltrh (which shows almost the same listing) ...
0
votes
1answer
69 views

OS X: invalid option -o

When I open terminal I got the following message invalid option: -o. I cannot use /bin/bash --login because I got the same result. I think that terminal try to execute bash login which can't be ...
0
votes
1answer
41 views

How to match .grd data and .txt data

I have a lot of data in .grd and .txt formats, for example: 20121201.grd 20121202.grd .. .. .. 201121231.grd and also: Result.2012.1201.txt Result.2012.1202.txt :: :: Result.2012.12.31.txt I ...
1
vote
2answers
97 views

bash terminal that remembers its state when restored from a crash

In Ubuntu, I use the default gnome-terminal to run my commands. I typically have a couple of windows open, each with several tabs. When my OS crashes∗, for whatever reason, and I reboot, I ...
1
vote
2answers
57 views

Message appears every time terminal is opened

On OS X Mavericks, whenever I open up iTerm (or the default Terminal), the following message appears: -bash: /etc/profile.d/sm.sh: No such file or directory -bash: /etc/profile.d/rvm.sh: No such file ...
2
votes
1answer
166 views

How can you remove duplicates from bash history?

Since I'm saving history from different sessions this is an issue where erasedups can't help because I'm using the following: PROMPT_COMMAND="$PROMPT_COMMAND;history -a" Is there an easy way to ...
0
votes
0answers
31 views

Why am I not receiving any system e-mails?

In my crontab, I have the following: * * * * * sh /home/rimmer/test.sh In /home/rimmer/test.sh I have the following: #!/bin/bash echo 'test'; I have also set chmod +x /home/rimmer/test.sh, of ...
0
votes
0answers
73 views

Bash, transforming a string list of words in a array

Sorry if I post a question on a topic discussed dozens of times. I'm trying to work on an element of an associative array and assign it to an array. I know that in bash associative arrays are ...
0
votes
0answers
19 views

Is there a way to enable either vim or emacs bindings for the tmux command buffer?

Normally, when we type a command to tmux, we do <Prefix>:, and get a line to type on at the bottom. Is there some option to set that command buffer to use either vi or emacs bindings for ...
0
votes
0answers
50 views

Bash MinGW ignoring Ctrl+O key combination

In Bash MinGW on Windows 7, I would like to use Ctrl+O to perform a history search backward. However, I can't get this work -- i.e., this line in my ~/.inputrc does nothing (although it does work on ...
1
vote
1answer
66 views

can't seem to populate bash array with new elements using '+=' operator

Like the title says. Trying to populate an array from zenity checklist output. Here is the function I want to run, but fails: function fSongType() { mType=$(zenity --list --title "Random song ...
1
vote
2answers
682 views

How do I get Linux commands and scripts to work on Cygwin?

I'm back with a follow up question. How do I get Linux commands to work on Cygwin? First I asked you what tool should I use to help me run my Linux scripts on Windows and you suggested Cygwin and I ...
0
votes
1answer
360 views

Install linux bash script from windows to a remote linux system

I have a set of bash scripts I want to install to a remote linux system. I have created a batch file to be run on the windows host system using plink and putty to transfer the files to the linux ...
0
votes
0answers
61 views

msysGit (Windows) and gpg-agent

Does anyone have a working setup to use gpg-agent in combination with msysGit on Windows? I have a setup for ssh-agent and it works fine but I can't get gpg-agent to work on Windows. I tried both a ...
0
votes
1answer
100 views

How to change bash prompt?

I'd like to change my bash prompt when I login. But even after I change .bashrc and re-login, it still prompts the old one. What goes wrong please? I want to get [\u@\h \W]\$ but I get \s-\v\$ for ...
0
votes
1answer
51 views

How to stop and continue the process

I used ps -fT pid to manage a bunch of process forked from the specified pid. Now I want to modify some settings so I want to stop the processes whose pid is in ps -fT pid. After the modification ...
6
votes
3answers
2k views

Could not create directory '/var/empty/.ssh'

Every day, after several hours of use, anything using SSH will just randomly stop working. The only solution is for me to restart my machine, which fixes it until it randomly occurs again. > git ...
0
votes
0answers
40 views

I'm trying to list size of folders plus selected files on a portable disk

For the purpose of finding the location of my data among many portable disks, I'm trying to create plaintext lists of the contents of all folders and files of certain extensions and sort them by size. ...
1
vote
1answer
95 views

Restore session/state in terminals

When I close my browser it remembers "state" in the sense that it remembers what tabs I have open and text that I had entered into various forms. Is there a way to do something similar with my ...
2
votes
2answers
62 views

quotes around filenames confuse bash script

I am writing a script that applies a command to loads of files. The way I automate this boils down to #!/bin bash for in_file in ${PWD}/*/*/*.txt; do out_file="${in_file//in/out}" ...
1
vote
3answers
53 views

Is there a tool that could help me use my Linux scripts in Windows? [duplicate]

I am new here. I would like to know if there is a tool that would help me use my Linux scripts in Windows? I am more comfortable with Linux commands than Windows. I also tried to download a software ...
0
votes
3answers
69 views

How to exec two commands in one find

I would like to find specific folders echo their name ls -l their contents My problem is that I don't know how to combine an echo {} and an ls -l {} in one find command. line for echo: sudo ...
0
votes
2answers
163 views

In associative arrays, assigning index and value at the same time

In a bash script I found the following but though it works I cannot understand its logic REMOTESNAPS+=(["$FS"]=" $SNAP") The statement above adds an element to the associative array REMOTESNAP by ...
0
votes
0answers
106 views

Correct way of setting Ruby2.1 as the go-to application when it referenced to/called via shell?

I have installed Ruby 2.1 on my headless Debian server (7.4) by downloading the source from https://www.ruby-lang.org/en/downloads/ and then running the routine of ./configure make make install ...
0
votes
2answers
144 views

ls command - long format field separator

Is there a way to use a different field separator for the long output of ls? I have problems in parsing the output of ls -l because some fields, in my case the group, contain spaces. I went through ...
1
vote
1answer
46 views

Launch and pass scripted commands to a Terminal script

I've got a.command, a script that waits for user entry (like typing something and then hitting return) It loops forever-ish. For example, it tells the user if their entry is a leap year, or its a ...
1
vote
1answer
170 views

How do i unzip files from a nested folder?

Say i have the following .zip file: ZipFile.zip /zipfolder/ this.file that.file theother.file When i try: unzip ~/path/to/my/ZipFile.zip -d ~/path/to/my/destination/ ...
0
votes
3answers
173 views

Text expansion tools for linux?

I am looking for a tool that can auto-close brackets and quotes in a terminal. For example, when I type echo " It should automatically expand into echo "" and put the cursor in the middle. This ...