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

learn more… | top users | synonyms (1)

5
votes
3answers
855 views

Why is this by passing the SUDO password?

I have a bash script I am using to automate a SVN checkout. The contents of the file were: #!/bin/bash cd /var/www-cake sudo svn checkout file:///usr/local/svn/bash_repo/repo/ Then when I double ...
4
votes
2answers
85 views

Emulate mouse click when hitting a key

I am trying to emulate left-mouse-down when Home key is down and left-mouse-up when Home key is released. The reason behind that is my touchpad's buttons are terrible and I like to use the ...
4
votes
4answers
416 views

Getting values from variables - bash script

I am trying to write a bash script to print values of the 3 variables. Keep getting errors. What am I doing wrong? INPUT1=/tmp/dir1 INPUT2=/tmp/dir2 INPUT3=/tmp/dir3 for i in 1 2 3 do echo ...
4
votes
4answers
3k views

segmentation fault when using su or sudo

example of the problem: $ su Segmentation fault $ sudo ls Segmentation fault I tried to compile sqlite3 from source earlier. I don't know what libraries it installed. This may be the reason why ...
4
votes
4answers
3k views

How can I make ssh-copy-id use a port other than 22?

How can I make ssh-copy-id use a port other than 22? I tried it with -p but I get: ssh-copy-id -p XXX XXXX@XX.XX.XX.XX Bad port 'umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ...
4
votes
1answer
3k views

Can't change theme of ZSH in Ubuntu 12.04

I have changed the theme in my ~/.zshrc file however whilst some of the colors in the prompt change the text size and background color remain as the Ubuntu default. Any one know how I can override ...
4
votes
1answer
7k views

Undertanding .bashrc and .bash_profile

On a server when I login as root I see .bashrc (ubuntu 10.10). On my Mac I have a .bash_profile, does ubuntu always have only a .bashrc file and not .bash_profile? (just confused so asking, I realize ...
4
votes
3answers
137 views

To which directory should I install a program from a bash script?

I want to install Netbeans 7.0.1 with a bash script from the Netbeans website. The default directory chosen by the installer is /home/geoffrey/netbeans-7.0.1. But I do not think it belongs there.
4
votes
1answer
2k views

Toggling between Unity 3D and unity 2D [closed]

Generally, I much prefer Unity 3D over the 2D version, which is a bit broken on my machine. However, I frequently give presentations, and Compiz doesn't support multiple screens. I've been forced to ...
3
votes
3answers
188 views

Sudo command in bash script halts the script

I have an early 2009 iMac with a sensor problem. The ODD and CPU fans run at full speed. To get them down to minimum speed in Ubuntu I need to set the speeds in the Terminal, using this method. Rather ...
3
votes
4answers
398 views

Add to path only sh file not a dir

I have a bin folder with a bunch of sh files. For example "server-run.sh", "server-stop.sh", "server-do-something.sh". And I want to run file "server-stop.sh" from anywhere. I could add this bin ...
3
votes
1answer
921 views

How to check in a bash script if passed argument is file or directory?

I have to write a simple bash script in Ubuntu which would allow me to pass it some arguments and I want to check if these arguments which can contain spaces are files or directories. How can I do ...
3
votes
1answer
81 views

no features in bash in new vps?

I have 12.04 server minimal running on my VPS. When I ssh into the server, only $ is showing at the prompt for each prompt. There's no typical <directory> <username>$, no autocompletion ...
3
votes
2answers
3k views

Run Bash Script as Root

Is there some way I can run a Bash script as root without being prompted for a password every time? I'm attempting to automate the process of starting my LAMPP install, which requires me running a ...
3
votes
2answers
3k views

How to replace/fix a messed up /bin/sh and /bin/dash

I have corrupted my /bin/sh and have no idea how to replace it. I accidentally copied over it. How can I fix this? I am running Ubuntu Server 11.10, no X. update: I have tried the fix that was ...
3
votes
2answers
758 views

Wget like utility to download all images in mysite.com/img/ directory

My access to the mysite.com/img/ directory is blocked. However all the images in that directory are in the form n.jpg where n is the nth image. My access to mysite.com/img/n.jpg is not blocked Is ...
3
votes
4answers
221 views

Is there a way to take influence on behavior of bash history?

In terminal the bash history is often helpful when you are searching for a command-line that you already used. But is there a way to influence the behavior of the bash history (i.e. which commands are ...
2
votes
1answer
45 views

bash comparing multiple column in two files with different length

I have following data set in text file data.txt d1,40,gold d2,30,silver d3,20,bronze d4,10,iron d5,5,wood d6,20,gold d7,10,wood d8,5,gold d9,10,silver . . . def.txt gold,40 silver,30 bronze,20 ...
2
votes
1answer
155 views

Why isn't .profile sourced when opening a terminal?

Just installed Ubuntu 14.04.1 LTS. According to .profile, # ~/.profile: executed by the command interpreter for login shells. # This file is not read by bash, if ~/.bash_profile or ~/.bash_login ...
2
votes
1answer
170 views

fsl.sh cannot be sourced

I need to install FSL and Freesurfer as part of running Connectome Mapper. Freesurfer required changing the shell to tcsh in order to configure its folders. Now for FSL, I have to add to .profile the ...
2
votes
1answer
290 views

How to remove element from gsettings array in script?

Array in dbus/gsettings has a format [element1, element2, element3, ...]. Gsettings' interface allows only replacing existing array with another, so for instance, adding another item element can be ...
2
votes
2answers
404 views

Temperature & RAM monitoring script

I have the following script: while : do clear; echo "---------------------------RAM Load------------------------------$ free -mt >> memory.txt; free -mt; ...
2
votes
4answers
906 views

Bash History not containing all history and blank after reboot, how to resolve?

I've recently upgraded from 13.04 to 13.10 and realized my terminal bash history is not surviving reboots. cat ~/.bash_history gave me a permissions denied error. I, possibly unnecessarily or ...
2
votes
1answer
2k views

Passing multiple commands to gnome-terminal from a script

My bash-script is not run in a terminal, but opens a terminal at runtime to ask for user input (sudo password). I would like to tell the user in this terminal what the script is trying to do. First, ...
2
votes
4answers
192 views

Using filename substitution — How to search for files with letters in this order?

So I need to find all files which have d, o, and g in the filename. The letters do not need to be side by side (aadaaoaagaa would be a correct filename, aaoaadaag would not be a correct filename). It ...
2
votes
2answers
5k views

How to rename all files in folder with name ending with “_backup”

I have a bunch of images that were somehow renamed from myimage.jpg to myimage.jpg_backup, so the images on my website don't load anymore. How would I recursively find all images ending with _backup ...
2
votes
1answer
958 views

How to execute a script before login screen?

I would like to know , how can I run scripts before the login screen.I mean My script should start running before login screen will appear.How can I achieve that?. I am the root user of that PC. ...
2
votes
2answers
524 views

“too many arguments” checking a condition and execute some action in case it's not true?

I have edited my sudoers file to allow my non-root user to run sudo commands without being prompted for a password. In vim, how do I create a function that checks whether this condition is true, if ...
2
votes
1answer
142 views

Is there a way to alias the command cd so that it protects the arguments?

When I run cd My folder There is an error because I have not protected the string. bash: cd: My: No such file or directory But this works fine cd "My folder" Is there a way to redefine cd as an ...
2
votes
1answer
805 views

How to run script at shutdown? [duplicate]

How can I make a bash script run only at shutdown? I have searched for it and keep coming up empty handed. I would be fine with either a link or an explanation to how to do it.
2
votes
3answers
3k views

I accidentally overwrite /etc/bash.bashrc file. Please give the default content

I accidentally overwrote the /etc/bash.bashrc file. Please give me the default content in that file to restore, or the file itself.
2
votes
1answer
199 views

Extra dash insertion when trying to run tar

I have a really weird issue where I'm getting an extra - insertion on tar: # tar -zxvf mod_wsgi-3.3.tar.gz /bin/tar: unrecognized option '--zxvf' Try `tar --help' or `tar --usage' for more ...
2
votes
3answers
391 views

What other bash variables are available during execution such as $USER that can assist on my script?

This is related to question 19245, in that one of the responders answered the question in an awesome way, and very VERY clear to any newbie. Now here is a question that i can't seem to figure. i ...
1
vote
1answer
2k views

Pause execution and wait for user input

I have a script that I am making and I have an issue with it: I would like to pause execution and wait for user input. I thought that I had it with the read -p -n 1 $foo command but the system is ...
1
vote
1answer
151 views

How can I remove an entry from a list in a shells script?

I have the following script: #!/bin/bash # Bash Menu Script Example PS3='Please enter your choice: ' options=("Option 1" "Option 2" "Option 3" "Quit") select opt in "${options[@]}" do case $opt ...
1
vote
2answers
329 views

Declare an array but not define it?

There are a lot of guides out there which show how to declare and define an array foo[0]=abc foo[1]=def What I am trying to achieve is to declare an array but not define it because it does not ...
1
vote
1answer
83 views

Keep working with bash while a program is running [duplicate]

I know, this is a very stupid question and the answer is out there in Googleland. But I just can't find it. I want to start a process/program (e.g. firefox) in bash and keep working with the ...
1
vote
1answer
239 views

Why does the “who” command not show “root” as a logged in user?

When I log in as root from gnome-terminal using the command: sudo su it logs me in as the root user. Isn't this switching a user considered as a log in? Also, which command can show me all the ...
1
vote
1answer
1k views

problem on java: not found

Initializing InstallScape using JVM at /home/manoj/iscap/iscape/runtime/LNX86/bin/java. This might take some time... /home/manoj/iscap/iscape/bin/iscape.sh: 209: exec: ...
1
vote
1answer
152 views

Bring all open terminal windows forward using a script

I am trying to use a script suggested for an answer I asked earlier, however I am having trouble getting it to work. The script should bring all instances of a program (whose name is passed as an ...
1
vote
2answers
351 views

Basic script listing directories ([: discover: unexpected operator)

I encounter an issue running a basic script listing directories. for item in * do if [ -d $item ] then echo $item fi done The outcome: lists all system folders returns an error: ...
1
vote
1answer
359 views

Bash alias permanent <without running bash or . ~/.bashrc>

I'm used to putting my alias in .bashrc, but Ubuntu suggests putting them in .bash_aliases. So that's fine, I put my alias there in the .bash_aliases file. However I want to run my aliases once I ...
1
vote
1answer
331 views

special character and parsing BUG - Bashscript

Failed to parse arguments: Argument to "--command/-e" is not a valid command: Text ended before matching quote was found for ". (The text was '"cpulimit') this is what i get when i run the following ...
1
vote
2answers
84 views

How to create a bash file allowing a folder from CD be transferred to Documents?

i want to transfer the myfiles folder from CD to Documents in a more decent way of transferring. I think creating an executable bash file is better. this bash file when clicked will allow the ...
1
vote
4answers
7k views

Init.d startup script not working for No-IP

I have just installed No-IP on a brand new Ubuntu 12.04 install. The program starts fine when I start it from the CLI, but if I try to make this startup script work it won't start. I got this script ...
1
vote
1answer
142 views

Unity Icon for a bash ran program

So I downloaded the .tar.gz for eclipse, extracted and set it up. I created a .desktop file so I could dock it in unity. I then want to be able to have a bash script open the program from the ...
1
vote
1answer
1k views

Why we can't run commands with gnome shortcuts?

When I make a custom shortcut with gnome (gnome-control-center keyboard) I can't set it to a command. Why? Example: I can't set a shortcut for sudo apt-get update. Instead I must first invoke a ...
1
vote
3answers
4k views

Can I create an SSH login script?

I have to log in to my school's Linux server for homework. I would like to be able to make a script or something for my desktop to save a bit of time (using Ubuntu desktop). Currently I log in using ...
1
vote
3answers
405 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?
1
vote
1answer
1k views

.bash_login not executing

I've put a .bash_login file in my $HOME-directory but it doesn't execute. I've also tried .bash_profile but also doesn't work. There are also .profile .bash_history .bash_logout Any idea? I'm ...