Bash is the shell used in Ubuntu's command-line interface.

learn more… | top users | synonyms (1)

3
votes
2answers
10k views

Using up arrow to run previous command

What setup do I need to use up-arrow to run previous command? With Mac, I can use up-arrow to rerun the command that I just run, but it doesn't seem to work with my bash shell. I use 8.04 (I can't ...
1
vote
1answer
968 views

Executing a Super-user command through .bashrc

Is it possible to execute a super-user command in .bashrc? And if so, how? It would save me having to execute "sudo /opt/lampp/lampp start" on each startup. I've considered using the LAMP stack from ...
3
votes
1answer
557 views

How to automatically graph the output of a shell function

I do a lot of video editing and processing, and spend a lot of time looking at the output of command line programs like ffmpeg. Ffmpeg produces a regular output of the form frame=1234 fps=80 q=-1.0 ...
4
votes
3answers
3k views

Bash script to start and then shutdown/restart various processes

When I start up my development environment, there are a variety of processes I need to run in the background. It is a pain to start them all individually so I want to write a script that starts each ...
13
votes
4answers
12k views

Tab completion doesn't work for commands

I am trying to use tab completion for commands in Ubuntu 11.04 Beta 1, running all the latest updates, but it doesn't seem to work. (Though package bash-completion is installed) Tab completion works ...
7
votes
2answers
5k views

How to find the version of an Ubuntu machine remotely?

I have more than 60 to 80 systems running Ubuntu. Some of them are with version 8.04 and some of them are with latest version 10.10. Now we are in the process of upgrading all older Ubuntu version to ...
2
votes
5answers
2k views

Need some help creating a script to rename text files and move them to a directory

I have recently managed to convince my mother to let me switch her PC to Ubuntu, and to make her transition easier I want to automate as many tasks as possible for her. I managed to do quite a bit, ...
2
votes
1answer
6k views

Where is bashrc profile for root?

I believe the question says it all. Also if it doesn't exist where do I create it. Ubuntu 10.04
0
votes
2answers
463 views

Replace IP address within a string

I'd like to change the IP address in this string with some user input: rmi.sceduling.service.url=rmi\://192.168.0.19\:1199/ScedulingService The code should also work if there is no address: ...
1
vote
2answers
597 views

Add Progress Bar

I would like to include a zenity progress bar for this part of my script: zenity --question --title "GUI" --text "Sync Music to iPad?" if [[ $? == 0 ]] ; then scp -r "$FOLDER" ...
4
votes
2answers
361 views

Combine Two Commands In a Script

I want to put two commands together I need the script to login: ssh root@192.168.0.188 Then I need to the script to run (while logged in to root@192.168.0.188 via ssh ): find ...
10
votes
4answers
7k views

Bash command history not working

The command history between sessions is not getting saved. I'm using guake and the history for the session is working fine. I noticed that .bash_history had some commands I executed in sudo -s mode ...
2
votes
3answers
297 views

Teminal non-responsive on load, can't enter anything until CTRL+C

I have an issue with terminal in Ubuntu 10.04. When I launch it, it hangs, like this: I cannot do anything until I press Ctrl + C: I cannot remember when this started. What can be wrong? Looks ...
1
vote
3answers
6k views

Replace string in bash script

I tried the following command in my script: find=grep "$jasper" jasperreports.properties | awk -F"reports/" '{print $2}' Example output: maps I want to change this output to something else, e.g. ...
1
vote
3answers
398 views

Script to move pictures

How can I write a script that will move all .png .svg .gif files from /home/eric/Desktop to /usr/share/icons?
5
votes
1answer
2k views

How to execute a script as super user first checking the user and getting pass from askpass if not super user

thers a similar question out there How can I determine whether a shell-script runs as root or not? I have the same doubt with different result Is it possible to, within the BASH script prior to ...
40
votes
0answers
10k views

How can I determine whether a shellscript runs as root or not? [duplicate]

Possible Duplicate: How can a script check if it’s being run as root? This is something I've been curious about. I make a lot of small bash scripts (.sh files) to do tasks that I routinely ...
5
votes
1answer
1k views

Command to determine whether a fullscreen application is running?

I have a small shell script that plays a little jingle and displays a notification whenever I get a new email. The problem is that this shell script can get invoked anytime - including when I'm ...
3
votes
4answers
497 views

OS evaluate in bash script

i was thinking in way that before run my script , evaluate which operating system that user use ubuntu or solaris , am using this because there is some differences in command option in each OS ...
3
votes
2answers
13k views

Read file into array

How can I read file in shell script , then assign each line to an variable that i can use later ,,,(am thinking in way to load an default setting from file) i already try : process (){ } FILE='' ...
28
votes
3answers
93k views

'chmod u+x' versus 'chmod +x'

What is the difference between chmod u+x and just chmod +x? I have seen a ton of tutorials that say to use u+x to make scripts executable. However, the u is not mentioned in the chmod help or ...
2
votes
1answer
2k views

Terminal error messages: bash: /dev/cgroup/cpu/user/2823/tasks: No such file or directory

This is what I get when I start up the terminal: bash: /dev/cgroup/cpu/user/2823/tasks: No such file or directory bash: /dev/cgroup/cpu/user/2823/notify_on_release: No such file or directory bash: ...
1
vote
1answer
2k views

How to get nicer error-messages in this bash-script?

I'm trying to catch any error when run a command in order to write a log-file / report I've tried this code: function valid (){ if [ $? -eq 0 ]; then echo "$var1" ": status : OK" ...
4
votes
1answer
551 views

Problem manipulating text using grep

I want to search for a line that contains log4j and take 7 lines before and 3 lines after the match. grep -B7 -A3 "log4j" web.xml After that I want to add comment tags before this paragraph and ...
14
votes
4answers
49k views

Where is .bash_profile?

I want to put new aliases to my .bash_profile file, but I cannot find this file. Where is it supposed to be?
2
votes
1answer
466 views

Script to download music and transfer to Ipod?

I need help making a script that would do this This is what I would do manually in terminal (I will be using the .getmusic script from 360 percents to download myspace music): cd /home/eric/Music ...
4
votes
2answers
7k views

How can I read user input as an array in Bash?

How could I read user input as an array? :)
5
votes
4answers
8k views

Setup CRON weekly backup

I want to make a backup of my /var/lib/mysql and /var/www folders and save them as tar.gz files to my mounted network file server (uslons001). Here is my bash file located in: ...
11
votes
2answers
15k views

How do you change the default shell for ALL USERS to bash?

I want every new user from now on to have bash as their shell by default. I know that to change your own shell to bash, you would use the command "chsh -s /bin/bash", but how do I automatically set ...
2
votes
1answer
273 views

Anomaly with bash PS1 definition

My root and admin user both have the same .bashrc file. The prompt section of the .bashrc is the following: if [ "$color_prompt" = yes ]; then ...
2
votes
2answers
2k views

Sed problem in a Bash script

I'm having a problem using the sed command . I'm trying to write a bash script that does the following : search for the line that contain :@ then save the line that contained :@ and replace it ...
0
votes
1answer
2k views

How do you unset an environmental variable using a script?

If I have HTTP_PROXY defined in default my environment (by ~/.bash_profile), how can I unset the variable from a script? I know that I can do unset HTTP_PROXY from the command line, but if I try to ...
2
votes
1answer
6k views

Run simple bash script to start applications at login

I want to run a simple bash script automatically when I log in. For example #!/bin/bash echo "start spotify" gnome-terminal -e spotify --title spotify When I run this command, one gnome-terminal ...
6
votes
4answers
8k views

Problem with Bash script: 'declare: not found'

I had a script which was running fine but when I ran it today, it says declare: not found. I am using bash shell and path at the starting of the script is correct. Two flagged lines in my script are ...
18
votes
2answers
14k views

How to grep 2 or 3 lines, one containing the text I want, and the others just below it?

This is a snapshot of error log: 06:16:29,933 ERROR EmailRMManager$:45 - Exception In get Message com.rabbitmq.client.AlreadyClosedException: clean connection shutdown; reason: Attempt to use closed ...
1
vote
2answers
927 views

concatenation of two command in one single command

while read pos; do string1= echo $pos | cut -c 20-38 string2="=$pos" string3="$string1 $string2" echo "$string3" done < file This is the code of my script. I want to display the output in one ...
15
votes
4answers
10k views

Script to display all terminal colors

Throughout the internet I have seen many people with scripts that prints out a bunch of stuff in all the colors defined in ~/.Xdefaults. However when I try to use these, I always get error: Bad ...
7
votes
2answers
12k views

How to make bash script run with a latency (i.e. wait 1 sec at each iterations)?

I have this bash script; for (( i = 1 ; i <= 160 ; i++ )); do qsub myccomputations"${i}".pbs done Basically, I would prefer if there was a 1 second delay between each iteration. The reason is ...
26
votes
5answers
4k views

Removing folder named ~

This is the output of ls -l ls -l total 53484 drwxr-xr-x 3 root root 4096 2011-02-10 05:59 ~ -rw-r--r-- 1 root root 54313810 2011-02-13 05:09 jobs.jar -rw-r--r-- 1 root root 384035 2011-02-15 ...
1
vote
1answer
706 views

Initialise a variable with a specific date in a specific format

I want to initialise a variable with yesterday's date in a specific format . ex---if today is 15 Feb, then variable should be-- var=Feb 14 date -d"-1day" +"%b %d" is not working. I don't know whether ...
5
votes
5answers
5k views

How to have a path containing spaces in PATH?

I tried export TASK=$HOME/Ubuntu\ One and export TASK="$HOME/Ubuntu One" but neither works.
1
vote
2answers
1k views

Exporting bash function in .profile or .xprofile kills X during login

I'm trying to export a bash function during Gnome login using one of the login shell start-up scripts. I've tried doing it in ~/.profile and ~/.xprofile but it results in X dying and restarting at the ...
11
votes
3answers
8k views

Environment variable vs Shell variable, what's the difference?

Somebody told me that: BASH isn't an environment variable, it's a shell variable What's the difference?
1
vote
0answers
241 views

Creating basic ACPI event makes the system unusably slow [closed]

I want to change a few settings on my laptop when I switch to battery power. I created a new event in /etc/acpi/events/cust-battery and it looks like this: event=battery action=/home/skerit/power.sh ...
1
vote
1answer
482 views

.bash_history and .cache

I have a user who's home directory is a Mercurial repository. Mercurial notified me that there were 2 new unversioned files in my repository. .bash_history and .cache/motd.legal-displayed. I assume ...
11
votes
5answers
11k views

Commandline shortcut for current directory similar to ~ for home directory?

When i use the cp or move command in a terminal window, i'm currently with bash in a certain folder like this. NES@server:~/Desktop/dir1$ And now i wanna copy a file from here ~/anotherdir/dir2 ...
6
votes
3answers
4k views

Bash scripts will not run without typing “bash” in front of it

On our school system, we're able to run script files without typing bash or csh or what have you without indicating what script type it is. On Ubuntu, however, I'm required to type bash script.bash ...
3
votes
4answers
4k views

execute script after desktop loaded?

I want to execute bash script on startup that opens several terminals in different workspaces. Script works just fine if I call it from terminal, but it doesn't work if executed from crontab using ...
3
votes
1answer
359 views

Is there a folder in my home directory where I should put my scripts so they are available from any directory?

Where should I put my script in my home directory so that I can access it from any directory? I've tried: o@s:~/$ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games ...
45
votes
2answers
14k views

What is the difference between “source” and “.” in bash?

As the question says, what is the difference between executing a script with source command and with . , i.e.: source /some/script and . /some/script