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

learn more… | top users | synonyms (1)

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
708 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
220 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
87 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
230 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
341 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
801 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
1k 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
183 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
4k 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
893 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
506 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
139 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
791 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
1answer
197 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
389 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
1k 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
125 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
200 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
79 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
214 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
881 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
146 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
331 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
327 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
294 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
3answers
6k 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
139 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
390 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 ...
0
votes
1answer
41 views

Need Help Improving Script

I have a group of folders (L1N-L5N), in which I want to copy from my /home/michael/documents/XXX to my Dropbox folder. At present, I have used the following script: #!/bin/sh cp -ra ...
0
votes
2answers
131 views

Install only bash from trusty on old distributions (to be save from Shellshock vulnerability)

Is there a way to just install only bash from the latest distribution on an old mashine? I once did pinning to a certain version of a package, but that was bevcause I didn't want to update that ...
0
votes
4answers
109 views

Creating a symbolic link to a directory

I have a directory to which I want to create a symbolic link. The commands I used were: cd workspace_b4a cd android-sdk-linux ln -sv build-tools/20.0.0/lib/ platform-tools/lib The output was: ...
0
votes
0answers
35 views

getting error in opening py file [duplicate]

I'm installing a software in Ubuntu 12.04 and got the following error: http://paste.ubuntu.com/7638369/ server@ubuntu:~/Desktop/revkit-1.3$ ./tools/gui/gui.py Traceback (most recent call last): ...
0
votes
2answers
189 views

how do I enable ccache

I am completely noob at this, i don't know what the make file is, and I don't know what bashrc is. but i do know where to download source code and use source somebash.sh then make file (as was told ...
0
votes
1answer
499 views

Execute script in sh mode instead of bash in Shell

I added my script called mylovelyscript.sh to /bin/ folder. My script contains code that echos text with different text colors. But when I run my script like $ mylovelyscript it executes in bash ...
0
votes
3answers
116 views

Strange autocompletion behavior

Well...I'm so confused, cause the only real problem in my case is freaking apostrophe ('). Situation: expanding PATH variable influence word completion, based on whether was apostrophes in additional ...
0
votes
1answer
416 views

bash: /home/gaja/.bashrc: line 4: syntax error near unexpected token `('

When I open the Terminal I got the following the errors. bash: /home/gaja/.bashrccu: No such file or directory bash: /home/gaja/.bashrc: line 4: syntax error near unexpected token (' bash: ...
0
votes
1answer
4k views

Double-click on .sh file to open terminal and execute series of commands in it?

I'm trying to double click on a file that does this: #!/bin/bash #Mount USB Jump, Copy files to it, Unmount it. [open terminal (so that I can see what 's going on)] pmount /dev/sdc JUMP sleep 2s cp ...
0
votes
2answers
433 views

Logging of commands executed in Bash

Sometime back, we had a requirement to log commands run on the terminal in the Bash shell. This was solved by means of a startup script with essentially the following contents: #!/bin/bash ...
0
votes
1answer
188 views

run a script as non-root user

I want to run a script say some_script.sh(that requires root permissions, contains some sudo do something in a for loop) as non-root user. I have a script as shown below. I want to run this script as ...
0
votes
1answer
133 views

Why does the script list directories starting with uppercase first, and all-lowercase second?

The thread is an extension of: Basic script listing directories ([: discover: unexpected operator) When I execute the script: for item in * do if [ -d "$item" ] then echo "$item" fi ...
0
votes
1answer
205 views

How can I execute scripts as root without pointing to its location?

I tend to use sudo arp-scan --localnet --interface wlan0 a lot, but I find it cumbersome to type this each time. To speed things up, I've created a script, called arp-lw-scan, which should do this for ...
0
votes
2answers
384 views

History list without timestamp and unique the results

Using bash, I save my history with the timestamp. How do print the history omitting the timestamp? alias h=history alias g=grep -i To find lines that I used for heroku, I type: > h | g ...
0
votes
1answer
1k views

What is this PS1 variable doing in .bash_profile file?

Currently my terminal prompt looks like: blankman-MacBook-Pro:~ $ My .bash_profile has: export PS1="\[\033[36m\]\h:\W \[\033[33m\]\$(parse_git_branch)\[\033[00m\]\$(git config ...
0
votes
3answers
1k views

Launch two processes and return first process to the foreground so it can be killed with ctrl-c

I am launching two processes in a bash script: run_webserver xdg-open http://$(hostname)/dev-environment The run_webserver is an ongoing process, so I need to be able to kill it with ...