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

learn more… | top users | synonyms (1)

1
vote
2answers
9k views

Change the terminal prompt [duplicate]

This can be really trivial,but it helps in ways of making it more comfortable while coding and sending commands to terminal. My terminal source/bash/root name(my apologies, I dunno which is the right ...
0
votes
2answers
897 views

Redirection Doesn't Work

I want to put my program's output into a file. I keyed in the following : ./prog > log 2>&1 But there is nothing in the file "log". I am using the Ubuntu 11.10 and the default shell is ...
2
votes
3answers
2k views

Why won't environment variables added to .profile show up in screen

I'm running Ubuntu 12.04 I added export LD_LIBRARY_PATH=/home/dspies/workspace/hdf5-1.8.11-linux-shared/lib to .profile but when I log in and open terminal and put echo $LD_LIBRARY_PATH there's ...
0
votes
1answer
122 views

Why won't my script work?

umm my script isn't working and I don't know why, it gives me the error "update1.run: line 187: syntax error: unexpected end of file" Here's my code http://pastebin.com/4W4AwuY5 I would really ...
1
vote
2answers
461 views

How do I set and use shell variables?

IRSTLM=$HOME/irstlm I need help setting this variable up. Was wondering if this is correct syntax IRSTLM=/home/user/irstlm Is that possible to run from root? I need it to be done in root in order ...
4
votes
2answers
96 views

How do you print/recall the definition of a function in bash

I can define and print the contents of variable called my_var like this: my_var="hello" echo $my_var but if I define: my_funct {echo "hello";} how can I recall my function's definition later on? ...
7
votes
2answers
8k views

How to pass results of bc to a variable

I'm writing a script and I would like to pass the results from bc into a variable. I've declared 2 variables (var1 and var2) and have given them values. In my script I want to pass the results from ...
2
votes
3answers
514 views

How to declare functions as variables

I want to declare variable with pwd() function, which will give me the current path. I want to use pwd() function as ${pwd} variable, something like that. How I must write? Thanks!
1
vote
2answers
286 views

Always use `-P` flag with `cd` command

How can I set -P flag to every cd command? I do that every time. There are LS flag environment variable which I could use for ls command so I wonder can -P be set as default?
5
votes
1answer
75 views

What is the difference that explains different results of different ways to assign values in a command-line?

What is the difference that explains the different results of these commands? a=2 echo $a set a=2 echo $a a=2; echo $a set a=2; echo $a
1
vote
2answers
3k views

PATH-variable gets always reset. How to fix that?

A little time ago, I found out, that I can create custom commandterminals with expanding the PATH-variable. Unfortunately, it gets always resettet, when I close the terminal and opens it again. Do ...
7
votes
5answers
701 views

How to use syslog for else output ( show up with whois - query )?

There is log-file /var/log/syslog with the output of ip-addresses like e.g. SRC=10.158.0.1. I want to scan from this file every printed address in SRC= ... and then to make query with whois (SRC= ...
0
votes
0answers
23 views

Where to set environment variables for all users [duplicate]

Apologies in advance if this question is very simplistic! I have Ubuntu 12.04. I manually installed Maven by downloading the binary tarball file and extracting it to the /opt/ folder. I then set the ...
6
votes
1answer
365 views

Bind byobu window to Ctrl+Shift+T shortcut

Ctrl+Shift+T shortcut runs the gnome-terminal by default. I have installed byobu, and I want this shortcut to open the latest used byobu session. When pressed multiple times, I should still have just ...
4
votes
1answer
505 views

How to run some alias command in bash's non-interactive mode

I want to run some alias command in bash's non-interactive mode. But seems Ubuntu ignore BAHS_ENV. How can I make it work? la is a alias command. And I tested in other linux. it is work fine. Just ...
20
votes
4answers
8k views

Bash auto complete for environment variables [closed]

The bash autocomplete feature does not seem to work with environment variables in 11.04. The current behavior is indicated below export SCRIPT=/home/user/script cd $SCRIPT/<tab> results in a ...
11
votes
4answers
9k 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 ...
8
votes
2answers
7k views

bash doesn't keep history

I run Ubuntu 12.04, and for some reason bash does not keep my command history. the ~/.bash_history file contains only 3 commands that I typed a few months ago. How can I fix this? EDIT: here's the ...
2
votes
1answer
153 views

Function to change title doesn't work when run in script

I've got a simple command that sets the term title: # Allow the user to set the title. function title { PROMPT_COMMAND="echo -ne \"\033]0;$1 ($PWD)\007\"" } export -f title I'd like to access ...
4
votes
1answer
4k views

wait for dd command to fully write to the disk

I'm using the dd command to create a bootable usb from iso file: sudo dd if=~/Desktop/ubuntu.iso of=/dev/sdx bs=1M After pressing enter it momentarily exits and gives me: 915+0 records in 915+0 ...
1
vote
2answers
436 views

Show just two lines in lm-sensors

I want to add lm-sensors to my conky setup, but it always shows this: coretemp-isa-0000 Adapter: ISA adapter Physical id 0: +41.0°C (high = +82.0°C, crit = +102.0°C) Core 0: +41.0°C (high ...
9
votes
1answer
2k views

Why don't custom upstart job names tab complete in the service command?

I'm used to create upstart services with a file in /etc/init/<service>.conf and it works perfectly fine, the only thing I'd like to is to have tab completion the same way that every service in ...
0
votes
1answer
57 views

Controlling a loop and saving the output for each event

How can I control a loop and read live feed from a usb port and save each of the output when the usb is inserted or removed. I know the code below can be improved, please assist. #!/bin/bash ...
1
vote
1answer
102 views

Compare files script

I am using this script to find information stored in one file using other file as a source for variables to look for: #!/bin/bash clear ...
1
vote
1answer
2k views

Launch rails webrick server at startup

I want webrick running at startup. So I execute this command in terminal: crontab -e Then added this line to the end of the file @reboot /home/myname/.rvm/rubies/ruby-2.0.0-head/bin/ruby ...
5
votes
2answers
12k 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 ...
5
votes
3answers
2k views

Going to the parent directory of a file with cd?

I am writing a .sh to do some work for me, but I am now at the point where I have to cd to the directory the file /path/to/file.end is in. terminal doesn't allow cd /path/to/file.end bash: cd: ...
0
votes
2answers
527 views

Why syntax error near unexpected token `fi' is coming

This is my simple script but it is saying that syntax error near unexpected token `fi' mysql --user=root --password= erpint -B -e "select * from user_info;" | sed ...
15
votes
4answers
952 views

How to get shared bashed history among different tabs

I used the answer in http://unix.stackexchange.com/a/1292/41729 to enable real-time shared history among separate bash terminals. As explained in the answer above, this is achieved by adding: # avoid ...
3
votes
2answers
1k views

How to create (via installer script) a task that will install my bash script so it runs on DE startup?

I've been reading for the last couple hours about Upstart, .xinitrc, .xsessions, rc.local, /etc/init.d/, /etc/xdg/autostart, @reboot in crontab and so many other things that I'm totally confused! ...
1
vote
1answer
3k views

Script to email files content

I have created a shell script that takes backups everyday and emails its execution as successfull or unsuccessfull. Now I want that it send the contents of log file it creates with the mail as well. I ...
5
votes
2answers
17k views

bash command for each file in a folder

I have a set of files on which I would like to apply the same command and the output should contain the same name as the processed file but with a different extension. Currently I am doing rename ...
2
votes
2answers
2k views

How can I run sudo gedit as gksu gedit

I'm looking into ways of automatically loading Gedit as gksu gedit when I enter sudo gedit by mistake? I have found that I have made a number of files unreachable by using gedit and I have only just ...
1
vote
1answer
3k views

when I run a bash file manually, it works, but crontab can not run it?

This is my sh-file: http://paste.ubuntu.com/5816543/, that I use this to download youtube files in a specific period per day. when I drag the file (y.sh) into the terminal and press return key, it ...
1
vote
0answers
327 views

javac cannot found, even after adding non-standart path to it in $PATH

Ubuntu 12.10, 32bit Problem too damn simple: I have a NTFS partition and unpacked from .tar.gz jdk on it. All I need from bash, is to see javac compiler, that is located in directory ...
0
votes
1answer
1k views

How do I start bash in 13.04?

I have a bash script that I need to execute. It seems that I can't run in in my terminal because it has a slightly different syntax. I could run the first file like bash ./configure but it produces a ...
3
votes
2answers
6k views

Proper way to let user enter password for a bash script using only the GUI (with the terminal hidden)

I have made a bash script that uses kdialog exclusively for interacting with the user. It is launched from a ".desktop" file so the user never sees the terminal. It looks 100% like a GUI app (even ...
0
votes
1answer
348 views

Help with “advanced” shell scripting | how to create an image preview of a pdf

First of all, sorry for my english: i'm not british/american. Here is my problem. I've got a folder named pdf with lots of files pdf inside it. I've got another folder named thumbnail, which is ...
3
votes
2answers
387 views

rm if there's a file with same basename

Say I have the following files: foo.coffee foo.js bar.js Is there an easy way how to rm *.js if there's a corresponding .coffee file? In the example such a command would remove foo.js leaving: ...
2
votes
2answers
701 views

How to move unknown files to unknown directories based on folder name?

I am trying to write a script that will search a directory for a folder, and move the folders contents one directory up from their location. this is what i have so far: find ./localFolders -name ...
1
vote
1answer
284 views

Cron job bash script to restart desktop sharing?

I'm having trouble with desktop sharing crashing while during remote sessions. Is there a way to set cron to check and restart, if necessary, the desktop sharing application with a bash script?
1
vote
3answers
269 views

Rename music files so they alphabetically follow a playlist

I have a bunch of mp3s I've organised into a playlist for a party. What I'd like to be able to do is easily rename these files so that they start with the position in the playlist: 001.Track.mp3 ...
0
votes
1answer
571 views

Can I safely store and display a master password file with AES-encrypted file plus a few simple bash scripts?

I would like to set up a couple of bash scripts to encrypt and decrypt a master text file containing passwords for banking, work, etc. for the purpose of editing it and displaying the entries when I ...
2
votes
2answers
144 views

Why usage of '*' doesn't always work on zsh?

I ran the following command on zsh sudo apt-get install rhythmbox* It produced an error, when I ran the same command in bash it worked. Why does this happen? How can I make the above command work ...
1
vote
2answers
2k views

Why does cp not copy files?

$ ls -la /tee/mysql total 28675 drwxrwxrwx 1 root root 448 Jun 25 13:52 . drwxrwxrwx 1 root root 2896 Jun 25 12:12 .. -rwxrwxrwx 1 root root 18874368 Jun 25 13:19 ibdata1 -rwxrwxrwx 1 root ...
0
votes
1answer
108 views

AMD different ways to install drivers

I do not want to know how to install drivers but what the differences between 2 ways and which one is better. building deb files from *.run file sudo sh*.run --buildpkg Ubuntu/precise installing ...
0
votes
2answers
573 views

How to set environemt variable without rebooting Ubuntu?

Problem: During Android development, in order to add ADB path to environment variable; I did following things in short- gedit /etc/environment - Added my desired path in the file such as ...
68
votes
4answers
92k views

Why ~/.bash_profile is not getting sourced when opening a terminal?

Problem I have an Ubuntu 11.04 Virtual Machine and I wanted to set up my Java development environment. I did as follows sudo apt-get install openjdk-6-jdk Added the following entries to ...
6
votes
1answer
2k views

Is there a centralized history file for all the commands run from various terminals?

I am aware that every terminal has it's separate history,which can be viewed by the history command. Commands issued on suppose terminal tty1 will be shown in the history of tty1 only and not in the ...
0
votes
1answer
373 views

wget and curl somehow modifying bencode file when downloading

(this is a copy from my post on Stack overflow I am hoping someone in the ubuntu community can shed some light on the situation for me) Okay so I have a bit of a weird problem going on that I'm not ...