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

learn more… | top users | synonyms (1)

2
votes
1answer
386 views

Bash function named with the question mark char does not work anymore

In Ubuntu 11.10 I had a bash command/alias/function like: function ?() { xxx $1 } This worked like a charm. Now in Ubuntu 13.04 it doesn't work anymore. When I try to execute the command with ...
5
votes
1answer
139 views

Alias cd and ls with support for spaces and arguments

So I started with this discussion, and it basically does exactly what I want. However, the solution to preserve directory whitespace using quotes fails when using arguments, e.g. cd -P dir. Any ...
4
votes
2answers
212 views

Something wrong with my `.profile`

I recently installed a few softwares and needed to add their bin/ directories to my PATH. Nothing abnormal so far. But I decided to be smart about it, and rewrote a part of my .profile so I didn't ...
2
votes
1answer
2k views

Alias doesn't work

I have written on .bash_aliases to run my shell script: alias testing='./testing' Problem I'm having right now is that it won't run the shell script. On the terminal it says the "command not ...
4
votes
1answer
48k views

Run executable file on terminal

I'm new to Ubuntu and currently on it because of assignment. I would like to ask few questions: 1) How do I make new command to run a shell script? For example, when you type "passwd" on terminal ...
2
votes
1answer
451 views

how to download a link in links using axel/curl?

shortly, how can I make lynx/links use axel/curl for downloading files that i want to store in my hard-disk?? Longley: I'm a server-manager and always used my ubuntu system and putty so i could ...
0
votes
1answer
110 views

sudoing my own bash scripting

Okay, so I have my scripts in ~/bin/, and they are added to the path normally. However, when I prefix them with sudo, they are not in the path. I figure this is because they're not in the path for ...
3
votes
2answers
318 views

How to batch organize files?

I have a directory with gigabytes (about 8gb) of small individual files. I want to organize them into directories by date. The date it was created is part of the filename. Here is an example of a ...
1
vote
1answer
892 views

Executing script from shell problem

Lubuntu Raring Ringtail. I want to be able to execute my scripts with ./ I start my python script with #!/usr/bin/python and it says bash : ./myscript.py: /usr/bin/python^M: bad interpreter: No such ...
2
votes
1answer
88 views

Help with a simple BASH script creation

The problem My 16gb LiveUSB session for Ubuntu 12.04 doesn't save certain settings/applications on the persistent section. I must shut down my laptop, thereby erasing everything stored on RAM ...
2
votes
1answer
149 views

How to reliably determine all folders not used in last 7 days?

I'm writing a script for cleanup job. The script needs to cleanup all folders which are not accessed for more than 7 days. Currently I'm using - for sub_folder in * ; do if [ -z $(find $sub_folder ...
1
vote
2answers
374 views

Setting default path when opening a terminal session

I am newbie to Ubuntu. Whenever I open a terminal it's path is set "/home/Varun" (as found by typing pwd). Is there anyway I can make the terminal's path to be set at "/home/Varun/Desktop/Java Files" ...
7
votes
4answers
29k views

Is it possible to pass passwords on a shell script?

Long time i am searching for this, i would like to know is it possible to pass passwords in a shell script? Many of the answers returned with no. Recently i read an article stating that how to pass ...
38
votes
1answer
93k views

Command to append line to a text file without opening an editor

Assuming i have a line that i want to add to a file without opening an editor. How could i append this line alias list='ls -cl --group-directories-first' to this file config.fish
5
votes
1answer
303 views

Tell if windows are open and not minimised from shell script Unity

I'd like to add into my .bashrc a little script that sets the terminal background to transparent iff I don't have any non-minimised, non-terminal windows open and leaves the terminal background as ...
3
votes
2answers
636 views

Bash script to start 'motion' on screen lock

I wish to write a bash script that executes on start up Ubuntu 13.04 and starts motion whenever the screen is locked. Being a novice at bash scripting, I wasn't able to understand the various help ...
2
votes
2answers
185 views

use Cron to mail log from a job

I have a weekly script that cron runs to make a zfs snapshot. I was wondering if it is possible to mail a OK mail if the job run correctly and a error mail if something happened and in the content of ...
0
votes
2answers
84 views

Shell script compsrison does not work as intended

The follwing code is for to compare two strings or variables. But, I cannot do it. I did a lot of googling, but no use. Here, output doesn't depend upon the changing of inputs. Can any one correct ...
2
votes
1answer
1k views

Creating new user, inconsistent bash prompt

I've created a new user profile with: useradd kitty passwd kitty mkdir kitty chmod 0700 kitty chown -R kitty:kitty adduser kitty sudo #when I did it I initially didn't ...
0
votes
1answer
2k views

why is source command not being run in .bashrc

I have a source command which i have to manually run every time I open a new terminal. source /opt/ros/groovy/setup.bash Thus I added the command into the .bashrc file. However the does not seem to ...
0
votes
2answers
2k views

Changing current directory to shared filesytem using linux terminal

I have a shared filesystem (E: in my installation of Windows 7) in which I keep my programming codes. I want to shift from Windows to Ubuntu for programming mainly because I like the linux terminal ...
0
votes
2answers
170 views

How to make a script which always activates on the startup? [duplicate]

So I'd like to add always a folder to the Path. I'm not a huge linux wizard but I think I would need to always write the "export PATH=$PATH:(directory)" line when I log in. But I need this to be on ...
5
votes
1answer
4k views

How to link a custom keyboard shortcut to a bash script in Ubuntu 13.04?

As an Ubuntu 13.04 user I had myself as well various problems and incompatibilities with this newest version of Ubuntu. One of these is that the Brightness bar has suddenly disappeared from the ...
0
votes
1answer
915 views

Check if torrent file is complete before copying

I have a crontab command that daily copies .iso files found within my torrents folder into an iso directory on a separate partition. My problem is that multiple .iso files will still be in the process ...
5
votes
4answers
2k views

A script for moving files from subdirs to parent dir

I am looking for a script for moving files from subdirs to the parent directory My folder structure looks like this. Inside of a folder A I have a lot of folders named 1,2,3,4,5... All these ...
1
vote
1answer
4k views

Help needed in passing arguments from command line in bash

#function myfunc myfunc(){ echo $1 case $1 in e) a=5 ;; q) a=10 ;; esac } myfunc I need help in following : $myfunc.sh e echo $1 is not ...
0
votes
4answers
3k views

single line group of commands as individual?

I made one small alias and got a question as , how to execute a single line group of commands as command by command with out breaking it ? echo " alias get='sudo apt-get install'" >> .bashrc ...
14
votes
3answers
1k views

Exclude from * in command line

There are plenty of situations where the use of a * is virtually inevitable - e.g. rm -rf * in a folder that holds thousands of subfolders and files. But what if you want to exclude just one or two ...
0
votes
1answer
92 views

who is $user with name as “festival”?

Have tried this script out of abs-guide (downloaded in this galaxy somewhere...) : http://paste.ubuntu.com/5952973/ It was written by Mendel Cooper. Now on my machine an user pops up with name ...
0
votes
1answer
181 views

Set command can't handle lines constituting of a \n (word/line counting script)

I have a problem with execution of a while loop, I have found out that the problem involves the execution of the set command, the assigment of the \n character to an environmental variable ...
1
vote
2answers
5k views

/bin/sh is a symbolic link that doesn't point to /bin/bash [closed]

I was installing the software environment of Armadeus experiment board APF27DEV, and when I tried the make command, it gave me the following error message: On your system /bin/sh is a symbolic link ...
0
votes
1answer
116 views

random lines with delay in between

I am using the following package to pull random lines from file(s) where line delimiter is % http://manpages.ubuntu.com/manpages/lucid/man1/rl.1.html rl -c 10 -d % myfile.txt -c 10 gives 10 lines ...
-1
votes
1answer
169 views

tar - command different to 10 years ago?

With this question am asking "old rabbits" of Ubuntu resp. of Debian. Am puzzled by the "newer" use of command tar - I know that 10 years ago it was possible to tar a file to 1/3 of size or even less ...
2
votes
1answer
2k views

Quit all instances of `gnome-terminal` via a command

This is half "this'd be useful for me" and half "hobby project" - I was wondering if it's possible to send a command via a gnome-terminal that will quit all instances of a program without using ...
1
vote
1answer
4k views

Commands not working after editing .bashrc file

I need to install a programming software called cuda for my academic purpose. Googling how to install it on my Ubuntu 10.04, I found these and I have done that. download the software cd ~/Downloads ...
0
votes
2answers
662 views

How to add your Eclipse workspace folder to your PATH?

I am using Ubuntu 12.04. Hi I have been working on the following issue for a couple of days and as much as a I look at the many different answers (What is PATH environment variable and how to add it) ...
1
vote
2answers
447 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: ...
0
votes
1answer
168 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 ...
1
vote
1answer
723 views

search and replace inconsistency between vim and sed

Using the Ubuntu 12.04 and vim 2.22.0, why inside the vim I shall use: :9s/\d\+/1/ to change first digit of the mentioned line to 1, but couldn't be able to use the same with sed as : sed -i ...
0
votes
2answers
5k views

Cannot access /etc/hosts

I cannot open my /etc/hosts file. I would very much like to, I have tried logging in as root and changing the ownership and changing the permissions, please help. When I try to open the file I get: ...
11
votes
2answers
4k views

Is there a difference between “.” and “source” in bash, after all?

I was looking for the difference between the "." and "source" builtin commands and a few sources (e.g., in this discussion, and the bash manpage) suggest that these are just the same. However, ...
5
votes
1answer
10k views

How to change a directory using shell script?

I am trying to change a directory to home/developer. I used cd home/developer in my shell script. After executing script it is again coming to original directory,where I executed shell script.
4
votes
1answer
730 views

Arrow keys in Terminal shortcut don't work

I am new to Linux and am using Ubuntu 13.04. I have a C++ program named "dictionary" (full path: /home/anmol/Desktop/c++/dictionary), which I compiled with Code::Blocks IDE (and GCC version 4.7.3). ...
0
votes
1answer
30 views

Command substitiution problem, confused

I am trying to have sox play a file from user input. To do this, I set up a command like the one below: $ play proc/$(read -n 1).wav I have files 0.wav through 9.wav located in the directory proc. I ...
2
votes
1answer
846 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.
0
votes
1answer
65 views

Any setup to version control ALL ubuntu settings?

Just now, I had to google for the third time in my life on how to disable that thing in Ubuntu, where you hold the super key and a help window pops up. Granted, there was a few months in between, but ...
0
votes
2answers
161 views

I am trying to check the mysql bind address int the terminal but keep getting error can someone help?

I am trying to check the mysql bind address in the terminal using the command cat/etc/hosts | grep localhosts that I got offline, but I keep getting a bash: cat/etc/hosts: no such file or directory ...
1
vote
1answer
198 views

Ubuntu .pam_environment for non-login shell

I remember in the past, we have two place to set env variables for Ubuntu Login shell - ~/.profile Non login shell - ~/.bashrc But now according to the doc [1], they are not recommended anymore. ...
0
votes
1answer
240 views

Why does my shell script only execute in execution mode “Display output”?

I wrote a bash script (here) for extracting EXIF GPS coordinates from an image and displaying those coordinates as a pointer in Google Maps. It works perfectly when used like this in the terminal: ...
0
votes
1answer
141 views

How to do tab completion with files that starts with special characters

I am unable to open a pdf file which starts with (. For example: (3311) M3N78-EM.pdf Are there any arguments to be given? I have invoked with evince command. When I type evince (and press tab, nothing ...