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

learn more… | top users | synonyms

0
votes
2answers
18 views

Zero out files in folder(s) that have space in file name

I'm trying to zero out (truncate) all the files in a folder or subtree that match a wildcard. Another post recommended using the find … -exec method over for variable in wildcard, which received high ...
0
votes
1answer
11 views

How to handle a condition when an expect script executing another script on a remote host is interrupted?

Im using an expect script to say xyz.exp to login to a remote host and execute another script abc.sh Now most of the times abc.sh runs fine, but there is a scenario where if a certain condition is ...
0
votes
1answer
5 views

Running the command “bochs -q” from Cygwin fails

I'm having troubles to execute the command "bochs -q" from Cygwin. I have installed the XV6 operation system in my C drive. I'm using Cygwin in order to compile the XV6 files, that is execute the ...
0
votes
1answer
9 views

Running a script if X server haven't been receiving any input for some time

I want to run a certain script when I'm not around my machine so it would run automatically but it would not bother me when I'm working. I created the bash script and queued it with cron, but it ...
-1
votes
2answers
46 views

simple loop not working

A simple script now="$(date +'%d_%m_%Y')" path="/var/www/vitalii/backups" sites=("site1.ru site2.ru site3.ru") for i in ${sites[*]} do echo "$path/$i" #tar -cvzf $path/$i_${now}.tgz ...
0
votes
1answer
19 views

Start two scripts that run indefinitely in shell script

I'm a webdev and I am using JSX compiler and SASS preprocessor to compile my .jsx and .scss files. When I start working, I launch these two separate commands: jsx -x jsx jsx js --watch --no-cache-dir ...
1
vote
1answer
12 views

How do I remove files from a range in a folder? [duplicate]

How do I delete a specific frame range in a folder? I have star_bg_true.0001.dpx star_bg_true.0002.dpx .... star_bg_true.0100.dpx How do I remove only frames 0030–0050?
-1
votes
2answers
40 views

Value of variable set in 'while read' loop looses value outside the loop

The following code is a simplified version of the real life task. Of course I know that I could achieve what is done in this simplified example with a if [ ... ]. This is only to demonstrate the ...
0
votes
0answers
33 views

ffmpeg through shell script is not running

I have to run a ffmpeg command . I am running the below command in command prompt and works fine. ffmpeg -v verbose -i rtsp://99.192.203.99:8091/test.sdp -i rtsp://99.192.203.99:8091/test.sdp ...
1
vote
2answers
14 views

Is there a way to have sh/bash/zsh “case” use a variable for a test value?

I'd like to have something like the following: #!/bin/sh # ... other stuff ... # some relatively static possibilities (srsp): srsp='this|or|that|the|other' # more other stuff case $something in ...
0
votes
1answer
17 views

shell standard streams redirection order OR 2>&1 1>/dev/null vs 1>/dev/null 2>&1

Can somebody please clarify differences? Is some of those considered as best practice? If I remember correct I somehow on SO read that this 1>/dev/null should precede this: 2>&1 ls -al ...
0
votes
0answers
32 views

How can make netcat's bash server more useable?

I started server like: nc -l -p 3333 -e /bin/bash Then I connected as client: rlwrap nc localhost 3333 Why is netcat’s bash server so ugly for client? Without rlwrap I cannot even use arrow ...
1
vote
1answer
54 views

Run command for every line of a file in bash, passing lines as standard input

How do I pass some input to a command line by line (ie. invoke the command for every line)? xargs does not work because it passes the lines as arguments, not as standard input. The specific case ...
1
vote
0answers
26 views

bash- command does not work with php shell_exec

I want to execute following command on my Ubuntu server using php: android create project --target 8 --name $fname --path ./$fname --activity MainActivity --package $fpack 2>&1 The above ...
1
vote
3answers
36 views

How to move in a big jump on the bash shell?

Ctrl + A and Ctrl + E bring you to the beginning and end of the command line. How do you jump to the middle? or at least 20 chars or so? If any of you use bash a lot and type quickly, you end up ...
0
votes
0answers
13 views

Starting a chroot and drop into nonprivileged user home

I need to (temporarily) jail a non-privileged user. I tried something like: sudo chroot --userspec=mcon:users /wherever/chroottarget /bin/bash -i This almost works, but it doesn't set env vars ...
3
votes
1answer
35 views

how to control users login on Linux machine according to configuration file

I use the PAM to authenticate users login info from - http://linux.die.net/man/8/pam_listfile in my Linux red-hat machine I have 5 diff users user1 user2 user3 user4 user5 I want to enable ssh ...
-1
votes
0answers
8 views

Can reverse-i-search wrap around to beginning?

How can I configure (reverse-)i-search to wrap around to the beginning once the search hits then end of the bash history? I know that I can jump forth and back in the bash history with CTRL+S and ...
1
vote
3answers
28 views

sudo command won't run from script

Linux Mint. Ok, this is going to be seriously basic but for some reason, I am mis-understanding how this works. If I type the following commands, everything works fine: cd ...
1
vote
1answer
26 views

Alias one program in a different order than $PATH

I alias pandoc='~/.cabal/bin/pandoc' because I don't want to change my $PATH order just for this one program. In general, programs I installed in /opt/, ~/.cabal/, and so on should precede defaults ...
0
votes
2answers
45 views

How to run a script after startup on Ubuntu 14.04?

I have scoured the web and tried numerous solutions. Nothing has worked for me so far, hence this question. I have a rails application that I run with mongrel_rails start -e production -p 80. That ...
2
votes
0answers
34 views

What are the benefits of keeping Caps Lock on after swapping with CTRL? [closed]

I have swapped CTRL and Caps Lock (as it is easier for emacs/bash to have homerow access to the CTRL key). Most places I have read don't mention whether they just turn off Caps Lock (don't remap to ...
0
votes
0answers
17 views

How to pipe arguments into stdin?

I am trying to generate a private key using keytool command, but it asks me for many details like my key passphrase, my name and my organization details. I want to pass all the inputs in one command. ...
0
votes
5answers
34 views

No such file or directory after typing $PATH in terminal

when I write in terminal echo $PATH my output is :/home/bo/bin:/usr/local/bin:/usr/sbin:/usr/local/sbin:/usr/bin:/sbin:/bin but when I write just : $PATH this output I do not understand ...
1
vote
1answer
28 views

Terminal new window always shows -bash: Searching: command not found

When open terminal, it always shows -bash: Searching: command not found. It does not affect other functions, just each time, even though open a new terminal window, it still pops up at the top of the ...
0
votes
1answer
20 views

How to stream audio and capture at the same time

I would like to save the mp3 that is being stream to the local file for archival purposes. I'm using the following line in my bash script to stream audio from a USB audio device to my icecast ...
2
votes
2answers
26 views

/etc/profile not being sourced at login

I'm having a bit of an issue: Neither of my /etc/profile or /etc/environment are getting sourced at login! i.e: After boot, the global variables I've got set in /etc/profile (and /etc/profile.d/*.sh ...
2
votes
1answer
142 views

I have to manually start bash

I'm somewhat a Linux noob, so I'm sorry if this is a very basic question. I tried to look on superuser for other answers, but i'm not exactly sure what i'm looking for. So, here's my problem. When I ...
0
votes
2answers
34 views

bash sed/awk: replace string from a file searching in another file

i have a question about search and replacement on Debian. I have two files. One with: a:b c:d e:f and the other with: e c a` In the second file I want to replace a with b, c with d, e with f. ...
2
votes
0answers
43 views

How to curl or wget live tennis scores from a Google search page [closed]

Google has some nice live tennis scores displayed on the search page. If I search for "Halep", for example, I get the tournament she's currently playing, together with all the result and live score. ...
0
votes
0answers
30 views

Crossfading Video AND Audio with ffmpeg

This Super User answer crossfade between 2 videos using ffmpeg has got me so far, but now that I have tried many solutions and seen every SO link out there, it's time to ask you all for help. I am ...
0
votes
1answer
18 views

Escape string input to sed

I'm having some problems with replacing a string in a file using sed with a string that contains newlines. The following will fail completely. I assume I've got to escape the replace_with string, but ...
0
votes
1answer
28 views

How to cp multiple file extensions?

How do I cp multiple file extensions, like png, jpg and tif files? I tried: $cp ./*.(jpg|png|tif) ../output/ >bash: syntax error near unexpected token `(` $cp ./01_reliefs/*.\(jpg\|png\|tif\) ...
0
votes
1answer
11 views

how to keep bash from waiting for spawned windows gui program to close

New to bash. And new to bash on windows and git. When I run gitk in the git-bash shell created by msysgit, bash will effectively hang waiting for the spawned gitk to close... Whereas cmd launches ...
2
votes
3answers
161 views

What is the difference between terminal and bash? [duplicate]

When I open Terminal Window in Mac OS X, I can type bash and hit enter and I will see: Last login: Fri Feb 20 14:30:56 on ttys000 Korays-MacBook-Pro:~ koraytugay$ bash bash-3.2$ I can for example ...
1
vote
2answers
39 views

Wrong results when comparing two numbers with bc (bash)

I’ve encountered an error, probably a bug in bc. I encountered it when trying to compare two numbers on a script in bash. It turns out that when I do: echo "1.1E-2<1.1E-1" | bc -l It returns 1 ...
1
vote
0answers
12 views

bash Segfault by infinite recursion

I just noticed that the bash I'm using (4.2.25(1)) isn't protected against infinite function recursion. In such a case a Segfault happens (and the bash process terminates). To check this on your ...
0
votes
1answer
32 views

Is there any difference between -exec cmd {} and xargs -I?

Normally, xargs bundles everything together, but when used with the -I flag it seems to put evaluate everything as a single line. Does this mean it loses its speed advantage? Also if the -exec cmd {} ...
1
vote
1answer
32 views

Can't run /bin/bash… sometimes?

I’m on a Google Compute Engine which is running Debian Wheezy 7.4. I’ve been noticing strange things recently. For example, I can do sudo bash. But then, from root, I can’t do sudo -u anotherUser ...
0
votes
1answer
32 views

How to configure linux to display webpage at localhost 127.0.0.1 that allows javascript-issued terminal commands?

Sorry if I am confusing things (don't know much about this topic). Basically, I want to access my raspberry pi wirelessly from my phone as long as I am within a few meters of it, and in this situation ...
0
votes
4answers
47 views

Please explain the man page of command mv

I understand if I mv foo.file boo.file, I just rename foo.file to boo.file, and if I mv dir1/foo.file dir2/boo.file, I delete dir1/foo.file and make a copy of that to dir2 and rename it as boo.file. ...
1
vote
1answer
24 views

Removing illegal characters with Automator

I've been trying to write a Mac Automator service to remove illegal characters from filenames. I have it working, but the solution is a little inelegant and I was wondering if anyone would have a ...
0
votes
0answers
23 views

How can I automatically run two commands in different screen windows with an argument?

My process is ctrl+a 0 command $1 ctrl+a 1 /join#$1 I'd like to shorten it down to one command.
-1
votes
1answer
20 views

Find specific file with a for loop

I have a list of files in multiple directories. I would like to work on specific files but the naming is a little tricky. file_986.aln file_99.aa.aln file_99.aln file_991.aa.aln file_991.aln I ...
0
votes
0answers
13 views

Grep from Log & Calculate then alert

I have a log file, which has the below lines in it. I need a bash script, which takes the values in Bold (4092.1M / 20.1G) & do the math & then alert from Zabbix [Eden: ...
0
votes
1answer
38 views

bash: adding a common string to files found with wildcards

I'm wondering if there is a way to rename a wide range of files that are found using wildcard patterns. For example, say I want to scp all files that match a certain pattern, but append a string to ...
0
votes
0answers
51 views

Require bash script to be run with sudo (not as root user)?

I want to require a bash script to be run as the current user with sudo, but prevent it from being run if it was executed as the root user directly. This is because I'm doing some setup actions for ...
-1
votes
0answers
44 views

Command not found in a remote SSH terminal, but works in a local cygwin terminal

I am trying to execute a batch command on a XP machine from Windows 7 using PuTTY. If I am on the XP machine everything works fine using the Cygwin terminal. The batch executes. Using PuTTY I get a ...
1
vote
1answer
25 views

BASH - run commands before and after loop

I'm having a bit of trouble with a shell script. It's something so stupid I'm almost ashamed to ask, but I can't figure it out. This is the script: #!/bin/bash MAGAZINE=" 192.168.49.3 ...
0
votes
0answers
8 views

Bash/Cygwin synchronize two directories

I have small problem with synchronization of two git repositories. In first directory for example localRepo is only two subdirectories: localRepo/ dirA/ dirA1/ ...