Tagged Questions

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

learn more… | top users | synonyms

2
votes
2answers
70 views

My cursor is at the beginning of my bash prompt. Any ideas why?

I'm using a slightly modified version of Gary Bernhardt's (destroyallsoftware.com) .bashrc with homebrew bash 3.2.51. # . ~/bin/bash_colors.sh . ~/bin/colorize.sh [... snipped ...] # ...
1
vote
2answers
426 views

/usr/bin/env: bad interpreter: Operation not permitted

found some answers here that didn't help me so much ohad@Macintosh-2:/Volumes/develpment/global_constants (master *+)$ node_modules/.bin/mocha -w bash: node_modules/.bin/mocha: /bin/csh: bad ...
1
vote
1answer
109 views

SSH hang at the end of one command

Below command is not coming out : ssh -x -l root asr-bng-ubuntu "/usr/local/sbin/radiusd" But process is getting started when i checked in console. Able to execute same ...
6
votes
6answers
3k views

How to write a script that accepts input from a file or from stdin?

How can one write a script that accept input from either a filename argument or from stdin? for instance, you could use less this way. one can execute less filename and equivalently cat filename | ...
0
votes
2answers
105 views

How to continue running a program in bash

I have made a bash program in Ubuntu. The program is "rock, scissors paper with computer". I want to continue this program until the message "you win, bye bye". Could anyone suggest a method for me ...
0
votes
0answers
61 views

GZIP corruption with big files?

I came across a weird behavior: gzip v1.5 - Fedora r18 A file -rwxrwxrwx. 1 root root 3892576256 Apr 28 11:29 vm.qcow2 Initial checksum: md5sum vm.qow2 954c5461468d68daed3cef6a7b66bd8f vm.qcow2 ...
2
votes
3answers
97 views

Gnu parallel and ack not playing nicely due to stdin, pipe

I'm trying to use parallel and ack together to do some searching in parallel. However, ack seems to insist on using stdin if it finds itself in a pipe, even if you give it files to search: $ echo ...
1
vote
1answer
56 views

Need help in the shell script - gunzip and file command

This is on Ubuntu 12.04. I have a custom webkit based application where "browser" saves bunch of cache files. When triaging the problems, I have to inspect the cache. The cache directory holds many ...
0
votes
0answers
78 views

Specific command not recognized in only one shell

I'm running Windows7 as OS as my development machine. It has various Shells: cmd Powershell Mysysgit GNU Bash <-- this is the one not working PuppetLabs Shell Nodejs Shell PHPStorm built in ...
1
vote
1answer
81 views

Firefox - Download files using external bash script

Is possible to issue external bash script when files are being downloaded in Firefox? My goal is high customization. E.g. scripting something that will save files to specified folder based on ...
1
vote
2answers
52 views

change file name in linux

I have a lot of data with file name. 20110.bil 20111.bil 20112.bil ... 2011150.bil 2011151.bil 2011152.bil The pattern of above file name is: year+(0-152) 0-152 mean August 1 to December 31. I ...
0
votes
1answer
156 views

Stopped process doesn't continue to work after sending SIGCONT

I start cat in terminal: $ cat Then in second terminal I send stop signal: $ kill -SIGSTOP $(pgrep cat) And that works - cat is stopped. Now I want to wake up this cat process by sending ...
2
votes
1answer
69 views

How to source (or run) tail output

I am trying to load serveral variables from a file (not .bash_*) which has similar to: export MY_VAR='foo' The command I was using to "source" this was `tail -1 myFile` This works, but it I echo ...
1
vote
1answer
63 views

Iterating over multiple variables in a for loop

I'm trying to add users to the system from a file. The file looks exactly like this: user@domain.com password 1 user2@domain.com baddpassword 2 The numbers are their IDs. Its coming from a mysql db ...
1
vote
1answer
43 views

bash does not work when cd to a particular directory, read and write permissions denied

Trying to run a Perl's script in Linux Ubuntu 11.10, but when Cd to the path, says : no such file or directory, but i can clearly handle the files inside the path. when trying to change the ...
0
votes
1answer
150 views

how to change directory in ubuntu

I'm trying to change the directories of a symbolic link. ln -s /usr/local/mysql-cluster-gpl-7.1.5-linux-i686-glibc23 /usr/local/mysql When I type command cd /usr/local/mysql it is giving me error ...
0
votes
1answer
54 views

What does ps axuwfw return?

I am getting strange output including my old makefile output and process tree when running below command on linux ps axuwfw Also, what is the usefulness of the following command and how does it ...
4
votes
3answers
2k views

How to execute commands as root in git post-receive hook

I just recently set up a remote git repo on a server for a web app running as an Upstart service. I'd like to use the post-receive hook to trigger actions that are required to update the application ...
0
votes
1answer
310 views

How do I use variables in bash to output to a file and to a mail body with sendmail

I've been working on this little script and it's nearly at a point that I can start using it. The idea is to automate WordPress installs via Plesk. I've got Plesk setup with a cronjob to download ...
0
votes
0answers
27 views

Look for app/cache and app/logs directory and apply rules in /var/www/html

I need some help creating some bash script that help me on my development server by running this commands: HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | ...
0
votes
0answers
15 views

Run a service action with a file from a shell script

I use CloudApp and it has installed a handy service called “Upload to CloudApp”. I'm writing a build script that I want to hook into this service. Every time it is run I want it to upload the file ...
0
votes
2answers
104 views

How to rotate enumerated filenames similar to logrotate?

I have a couple of files, let's say map-0.jpg (newest), map-1.jpg, map-2.jpg, ..., map-9.jpg (oldest). Now my cronjob downloads a new picture from the internet and should save it as map-0.jpg. All ...
2
votes
3answers
55 views

Move all files in a directory in a subdirectory

I can't find a quick solution for this simple problem: I' ve got this tree: fatherDir -File1.txt -SomeFile.txt ... - A name.txt -sonDir I want to move all the files in fatherDir ...
0
votes
2answers
126 views

How can I run mogrify over the 3 million JPG files?

I have 3 million JPG files stored in a Linux CentOS 6 server. I want to change quality to %50 file size over 1 megabyte. I wrote this command but got an "argument list too long" error: $ find -type ...
1
vote
1answer
112 views

Color in bash prompt messes up git output

I changed my .bashrc to include export PS1="\033[1;33m\u@\h: \w>\033[0m" so that my shell prompt would be colored, but it seems the \033 messes up git output (log and diff, at least). I see ...
0
votes
1answer
177 views

Choosing shell for xterm in Cygwin

Basically my question is closely related to this one: http://stackoverflow.com/questions/21905380/how-do-i-get-cygwin-xterm-to-use-bash-and-not-sh I also want to set bash as the default shell for ...
1
vote
1answer
49 views

Read each line and use the line as input

What I want to achieve is: 1.Read a file line by line. 2.Put each content in a variable (stopping at the EOF, problem here is I don't know how many lines there is) 3.Use the variables ...
5
votes
1answer
632 views

Meaning of . and .. directories in linux [duplicate]

When display hidden file and directory in terminal using ls -la it show two directory i.e. . and .. and when list the content of dot(.) directory it contain all file and directories that is in it's ...
2
votes
0answers
572 views

tar: Cannot create symlink : File exists

I backup lots of gigebytes files in to myproject.tar.gz, and compress success without errors. Now, I want to decompress all to an folder "myprojects". adan@adan-Latitude-D630:~$ tar zxf ...
1
vote
1answer
77 views

A while or until loop, until a line with “REMOVE” content in bash. How do I do this?

I want to grep Ip addresses in a file until line with the "REMOVE" content. I tried the following thing but the script gives all IP including after "REMOVE". a="[A-Z]" cat *.txt| until [[ "$a" = ...
1
vote
4answers
110 views

Find all files where other files with different extension dont already exist

I want to use the find command, to find all files with a certain extension (avi), where the same filename with another extension (mp4) does not already exist. so considering these files: a.avi a.mp4 ...
0
votes
0answers
190 views

FFmpeg/Avconv: Scaling Filter “Error when evaluating the expression”

I'm trying to scale a video with FFmpeg with the following command: ffmpeg -i input.jpg -vf scale="'if(gt(a,4/3),320,-1)':'if(gt(a,4/3),-1,240)'" output_320x240_boxed.png This is taken verbatim ...
0
votes
1answer
134 views

running for loop - but wait for string of words in log file to continue

so far I have this: for each in {01..10} ; do ./sb0$each/tomcat_sb0$each start;done that will start my apps at once, but I want it to wait until it reads one line in a file, what's the easiest way ...
1
vote
2answers
99 views

htop status bars in motd

I'd like to put the htop status bars, that show the percentage of CPU usage and memory, in my MOTD, so that every time I log in I see an overview about the systems health status. Any idea how to ...
0
votes
0answers
21 views

Customized bash prompt (PS1) issues when text moving to next line and back.(word wrapping) [duplicate]

I'm using a customized prompt which includes and output of a "case" script and also colors it. When the text is colored I'm having line wrapping issues, when I remove the color - the issue is gone. ...
1
vote
2answers
103 views

Monitoring Excessive User Home Directory Growth

I am trying to write a script for a school assignment that will check and see if any of the non-administrative user home directories have increased in size by more than 100 MB in a single 20 minute ...
0
votes
2answers
92 views

Take a screenshot in mplayer2 and upload it to an image sharing site in one keypress

I have a bash script that uploads screenshots to imgur. I want mplayer to take a screenshot, and then upload it with the bash script, and all that in a single keypress. Is there a way to queue taking ...
0
votes
1answer
211 views

Bind bash script to keypress

How do I map a keypress on a keyboard to a bash script? For example, when I press the "Esc" key, the script is run. OS: XFCE Spin Fedora 19 ---- EDIT ---- I need to set this via the console. This ...
0
votes
1answer
49 views

batch rst2html conversion in a bash script

I have multiple .rst files in multiple folders and sub-folders on my Debian system. How can I create a script that converts all the .rst files in html (with the rst2html command) and creates new ...
0
votes
1answer
74 views

a script that multithreads using bash/batch and nconvert

i have over 500 (50MB) .tif files and i want to convert them to .png i have tried nconvert and find it working, but there is no multithreading, is there a simple way of doing it in a bash or batch ...
0
votes
2answers
51 views

Making PS1 prompt refreshable

I want my prompt to be changed based on an output of a certain command. and based on the command result to add a color. example: run the command: cphaprob stat | grep local | awk '{ print $NF }'` ...
0
votes
1answer
37 views

alias can't find a file that actually exists

On my personnal computer, not a server, in my .bash_profile (I'm on OSX) — sym-linked to .bashrc, I have the following line among some others : alias deploy=sh ~/dir/ectory/deploy.sh The file ...
1
vote
2answers
381 views

How to stop shell script if curl failed

I have script that used curl when i pass wrong parameters to script curl failed but script continue executing. I have tried use curl -f/--fail parameter but problem does not solved. What is the best ...
1
vote
1answer
113 views

Zsh autocomplete function with sed

I'm struggling to write an ZSH autocomplete function. My goal is to autocomplete ta's and tk's first argument with the projects listed in tmux list-sessions and tmuxinator list. Here's what I have so ...
0
votes
2answers
48 views

Bash : conditionally moving nested duplicate directories

Assume I have a directory named "foo" that contains several directories: foo/bar/bar/(files) foo/bat/bat/(files) foo/baz/qux/(files) Is there a way to conditionally move the 'deepest' directory up ...
0
votes
0answers
138 views

stdbuf not working while unbuffer does

I am trying to apply timestamps to stdout of a process. For the proper timestamps to be applied, I attempt to unbuffer stdout of the process. This works with unbuffer but not with stdbuf as I would ...
1
vote
1answer
81 views

Unbuffer swallows the exit status of killed process

The expect "unbuffer" command seems to swallow the exit status of its child if the process is killed. Is there something that can be done to stop this behavior? It does not swallow the exit status if ...
0
votes
1answer
29 views

How to check core dump enabledness status in bash?

$ ulimit unlimited $ sleep 2 && killall -SEGV cat & [1] 11358 $ cat Segmentation fault $ ulimit -c unlimited $ ulimit unlimited $ sleep 2 && killall -SEGV cat & [1] 11462 $ cat ...
1
vote
1answer
33 views

Strange probs with popd and pushd

Just when I thought I got popd and pushd, when I tried to practice on my own...it all went to hell. I removed the temp directory.I verified this by going through Finder. Then I made a new set of ...
0
votes
0answers
95 views

Unable to run tmux on OS X

So I got brew on my mac and I had tmux installed and running just fine. Then after I refreshed my system every time I try to run tmux i get this error: "-bash: tmux: command not found" So since I'm ...