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

learn more… | top users | synonyms

0
votes
1answer
103 views

COMP_LINE not set despite bash completion being installed

I'm using homebrew's bash completion package on OSX, which is installed in /usr/local/etc/bash_completion. It's working fine, but there are many extensions for it which rely on various environment ...
7
votes
6answers
14k views

When to use Bash and when to use Perl/Python/Ruby?

We are doing all our scripting with Bash so far, but I'm starting to feel a bit silly about it. While we can of course do everything we want with Bash (it's quite powerful), I'm starting to wonder if ...
2
votes
3answers
303 views

How can I make the linux time function prefix the output of a command insteading of placing the output after the command?

~$ /usr/bin/time -f "%e: " echo test test 0.00: I want the output to be 0.00: test How would I accomplish this?
1
vote
1answer
3k views

To set PATH on OS X when export PATH= don't work

I can't do 'export PATH=' When I try that only .swp files is created (.bash_profile.swp and .bashrc.swp). I'm on OS X 10.6. $ echo $PATH ...
4
votes
1answer
478 views

Is it possible to force bash tab completion suggestions to list in a single column?

When I'm typing a filename and double-press Tab, a directory listing occurs to suggest all options for the tab completion. By default it lists in the same format as ls however I would prefer it to ...
3
votes
1answer
4k views

How to overwrite file using echo?

When using echo "foo">> bar.txt more than once it appends to the end of a file. How to overwrite bar.txt each time?
2
votes
1answer
797 views

How do I make “bash -x” (debug mode) recurse into sourced scripts?

I'm trying to debug what bash does on login initialization for Linux. I've read that "bash -x" will make bash print out what it's doing, but it doesn't print commands in sourced files like "set -x" ...
3
votes
2answers
1k views

Execute shell commands at the startup on Ubuntu 11.10

I'm using Ubuntu 11.10 and I've to execute a shell commands at the startup. java -jar selenium.... I tried with this but nothing: sudo gedit /etc/init.d/nomescript.sh sudo chmod a+x ...
0
votes
1answer
965 views

How to get Ruby, when called from a shell script, to see RVM default Ruby

my ruby prog: #echoHW.rb while 1 < 2 sleep(10) puts "hey!" end the bash(?) script that calls it: #echoHW.sh ruby -v ruby echoHW.rb "$@" & I installed rvm, trying both "single user" ...
3
votes
1answer
1k views

How can I use Emacs in terminal mode and use Alt + ? shortcuts?

I want to use emacs in terminal mode, but in Ubuntu 11.10 the bash terminal already has many Alt started shortcuts, how can I handle with that ? Bye.
2
votes
2answers
1k views

Use output from command line as a parameter for a command [duplicate]

Possible Duplicate: How to replace a command with the result of another in linux? I'm able to parse my command output so it only shows the file name that I'm interested. My question is, I ...
0
votes
1answer
466 views

Solaris/Linux - tput command + create bold text

How do I bold the "Date & Time" numbers from the following file with the tput command (I have a Solaris machine)? For example, I want to bold only the "24-09-2009 16:17:45", etc. for all other ...
0
votes
1answer
1k views

Parsing out specific URLs from local html file

I want to parse out certain URLs from a saved html-file with a simple bash-script/command, so i can download them via wget laters. What i have so far is: awk 'BEGIN{ RS="<a *href *= *\""} NR>2 ...
1
vote
2answers
120 views

How can I see a detailed difference between files in the last git pull?

I run a git pull and see that a file has changed. I would like to see a line by line difference of what has been added or removed. I tried git diff 12345..67890 , (newest commit)..(second newest ...
1
vote
1answer
478 views

different .bashrc files for different login nodes?

Can I have different .bashrc files loading when logging into different nodes that share the same home dir? This is, I am mostly interested to loading different PATH directories when logging as bash, ...
3
votes
2answers
1k views

Wget - if / else download condition?

I want wget to prefer a certain filetype over another, if the files have the same basename. For example: if foo.ogg available, don't download foo.mp3 the way i use wget so far to ...
0
votes
1answer
494 views

signal spacebar key stroke on xte?

I have been using xte for some UI testing and I found that xte 'key Space' doesn't seem to do much. How can I signal a spacebar key stroke on xte (Linux)?
0
votes
1answer
1k views

Using rvm within a bash script on CentOS 6.2

I'm trying to write a script that does goes through all the steps for installing and setting up a graylog2 server and web interface on CentOS 6.2. Here is the section that I'm having trouble with: ...
2
votes
6answers
2k views

What could cause the file command in Linux to report a text file as data?

I have a couple of C++ source files (one .cpp and one .h) that are being reported as type data by the file command in Linux. When I run the file -bi command against these files, I'm given this output ...
1
vote
1answer
334 views

bash extended globs :: rm all *.jpg files except two particular ones

Can I use Bash extended glob patterns to implement logical 'AND' ? Say I have a folder of jpg files (among others) and I want to rm all jpg files except A.jpg and B.jpg. How would I do that without ...
1
vote
2answers
525 views

Find and hide file extension

I am trying to find all files that have the same filename (excluding the file extension) that occur 3 times. I also need the full path to the file. What I have currently is #get file without ...
0
votes
2answers
423 views

Modified .bash_profile and now I can't even use ls

I just added a few paths to /Users/userA/.bash_profile and sourced it. It seemed to work, I could access more programs. Now I can't even access ls. Only cd and source are still working. What do I ...
7
votes
1answer
762 views

How can I prevent the “You have mail.” message from displaying every time I open the Terminal

Every time I open the Terminal, I get the "You have mail." message, but I do not have any mail. When I run MAIL it reads, "No mail for myusername". I have tried several methods to prevent this from ...
0
votes
1answer
536 views

install xclip on a linux computer with no root access?

I am trying to install xclip on a linux computer with no root access, I downloaded, decompressed and run ./configure but got an error for a missing library: ./configure --prefix=/home/user/bin/xclip/ ...
0
votes
1answer
482 views

How do I execute my script by just typing its name?

I have a script in /home/username/scripts and I would like to execute it by just typing its name. I know I could do 'export PATH=$PATH:/home/username/scripts' but I would like to have the same ...
2
votes
1answer
628 views

What does 'select processes without controlling ttys' mean?

For the following command: ps x What does x achieve? The documentation specifies 'select processes without controlling ttys' but I don't understand what this means.
2
votes
2answers
647 views

How do you make zsh meta-delete behave like bash? (To make it delete a word instead of the entire path.)

Bash's meta-delete will remove one path component instead of the entire path. How do you get zsh to behave like that? I found this, which seems to work. Is this the right thing to do? One of the ...
3
votes
1answer
1k views

Subshell arguments in -exec parameter for find(1)

Why doesn't find . -type f -exec echo $(file={}; echo ${file:0:5}) \; give the first five characters of the file, while this works: find . -type f -exec bash -c 'echo ${1:0:5}' funcname {} \; ...
1
vote
1answer
1k views

escape file and directory names from find

How can I escape spaces and other symbols from the results of a find command? For example, this doesn't work if there are spaces and other symbols in the results: find -maxdepth 5 -type d -print | ...
0
votes
3answers
203 views

How to check there are no html files in current directory?

I have a script which will download html files into current directory. Then it'll generate a report based on these html files. At last, it'll delete all these html files. So, when I run this script, I ...
1
vote
1answer
308 views

How to embed multiple audio files to one video file with timeline offset?

I have a video file: screencast.mpg (100sec) And several audio files(file name indicate offset): 10.wav (10sec) 30.wav (5sec) 45.wav (8sec) How can I combine those files together: ...
2
votes
1answer
289 views

Bash script with grep -w

I am using the following command: x.txt | grep -w 'in' and I am getting answers like: in into ... etc. I only want the answer: in How should i modify the command?
2
votes
3answers
1k views

how to remove path of my command line?

When I start to enter in different folder the path is registered in my command line and I don't know how to remove it. I am almost sure my question wasn't clear. An example is always better. Once in ...
0
votes
5answers
456 views

How to create multiple directories use Bash

I want to create ten folders named foo1java, foo2c, foo3python, etc. I tried this but it creates too many directories: mkdir foo{1..3}{java,c,python} foo1c/ foo1python/ foo2java/ foo3c/ ...
1
vote
2answers
1k views

Diff and ignore lines missing in one file

I want to diff two files and ignore lines that are present in one file but missing in the other. For example File1: foo bar baz bat File2: foo ball bat I'm currently running the following diff ...
1
vote
2answers
18k views

Edit .bash_profile in OS X

How do I edit the bash_profile? I've tried using the command chflags but it shows the error [Error writing. Bash_profile: Operation not permitted] I'm using OS X Snow Leopard 10.6.8.
0
votes
1answer
42 views

-w test on OS X gives command not found error

I'm writing a bash script which I'm testing on OS X though it will ultimately run on a standard Linux environment and running into a weird error. I have tests like this in my script: if [ ! -w $BP ...
4
votes
2answers
8k views

Linux permissions and owner being preserved with cp

I can't understand the following behavior: I have a file named someFile under /opt/com/internal/someFile If I do ls -all /opt/com/internal/someFile the permissions are 700 user:userGroup I am root ...
1
vote
1answer
207 views

Automation of restarting the network without root permissions/password

I'm an avid torrenter, and since I'm busy must of the day, having Transmission-GTK run at night is my best option. However, my college server loves to kick people out after either an extended time ...
0
votes
5answers
1k views

Using find command to list top 5 image files by size

All, I want to list the top 5 image files (png,jpg) in a given folder.What's the best approach? I'm using the following currently but it doesn't give the right output: find . \( -iname \*.png -o ...
13
votes
2answers
15k views

Environment variables in bash_profile or bashrc?

I have found this question [blog]: Difference between .bashrc and .bash_profile very useful but after seeing the most voted answer (very good by the way) I have further questions. Towards the end of ...
3
votes
1answer
528 views

How do I edit previous lines in a multiple line command in GNOME Terminal?

When entering a command which spans multiple lines in Bash, how do I edit previous lines? I'm a Linux Mint (Lisa) user using GNOME Terminal. For example, let's say I type: $ echo "foo bar > baz ...
10
votes
2answers
587 views

What does a bare < do?

bash does not seem to complain if you run a command like $ < some-file-that-exists Nothing seems to happen. You could also use $ <<<"any string" and even process substitution. So ...
4
votes
3answers
683 views

Diff 2 files while ignoring parts of lines

I would like to diff a file system. Currently my bash script prints out the file system recursively into a file (ls -l -R) and diffs it with an expected output. An example for a line in this file ...
1
vote
4answers
581 views

How can I clean up my bashrc/zshrc file?

Over time, I've added bunches of stuff to my PATH and it's lookin' pretty awful. How can I clean this up or what's the proper way to "reformat" all of this? export PATH="$PATH:~/scripts" export ...
4
votes
5answers
2k views

What is the purpose of the `sh` command?

What is the purpose of the sh command when used interactively and when used inside of a bash script? Other than on the hash bang line (the first line) should sh ever be replaced with bash on a bash ...
1
vote
1answer
1k views

Is it possible to get user's input during installation of rpm?

Is it possible to get input from a user during an rpm installation? I have a script that works by itself (taking input from a user and doing actions) but when run as part of the post install of an rpm ...
3
votes
5answers
165 views

BASH: Adding existing filecontent to an existing file

I've to add the content of a file to the end of every prefs.js file. Tried it with find -name 'prefs.js' -exec more filecontent >> '{}' \; but it didn't work.
6
votes
3answers
565 views

Use msysgit/“Git for Windows” to navigate Windows shortcuts?

I use msysgit on Windows to use git, but I often want to navigate through a Windows-style *.lnk shortcut. I typically manage my file structure through Windows' explorer, so using a different type of ...
6
votes
2answers
900 views

What is the full name of rc file? e.g. bashrc? [duplicate]

Possible Duplicate: Sayvimrcor screenrc, what does the rc mean? There are lots of rc file inside linux? .bashrc .vimrc .gvimrc etc etc I am curious what does rc mean? I can't find any ...