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

learn more… | top users | synonyms (1)

4
votes
2answers
169 views

How can I auto-hide the launcher via a script, when I maximize the browser?

I was trying to control Ubuntu 14.4.1 Launcher's behavior. I want it to auto-hide every time I have browser window like firefox maxmaized. I found this solution: #!/bin/bash ## Change value of ...
6
votes
5answers
349 views

Add column from one .csv to another .csv file

file1.csv A,,C,D A,,C,D A,,C,D A,,C,D file2.csv A,B A,B A,B A,B desired Output.csv A,B,C,D A,B,C,D A,B,C,D A,B,C,D I've tried using "join" and "paste" to no avail. Is there a bash command to ...
1
vote
1answer
21 views

Run sudo command within directory

Possible solutions could be: Starting interactive session. sudo -s <<< "cd dir ; command" or sudo /bin/bash -c "cd dir ; command" But I don't have /bin/bash /bin/sh /bin/su or other ...
13
votes
4answers
821 views

Is there any default function/utility to prompt the user for yes/no in a Bash script?

Sometimes I need to ask the user for yes/no to confirm something. Usually I use something like this: # Yes/no dialog. The first argument is the message that the user will see. # If the user enters ...
2
votes
1answer
35 views

Find not removing files in folders through bash script

I'm very new in bash scripting and I'm really stuck on the find method from Ubuntu. I want to search in the folder /opt/ for all folders to see if they are older than a specific date. If they are ...
3
votes
2answers
37 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 ...
-1
votes
0answers
29 views

Cuttlefish #!/bin/bash not working 0.o

I was running Cuttlefish on Ubuntu 14.04 with 2 scripts to dim and un-dim my screen when AC power changes to battery and reversed. I reinstalled today and can't make the script dimming or un-dimming ...
4
votes
2answers
156 views

Shell gives no prompt if auto completion is enabled (blinking cursor instead)

I tryed to enable shell autocompletion uncommenting the following lines in my .bashrc: # enable programmable completion features (you don't need to enable # this, if it's already enabled in ...
1
vote
0answers
22 views

How to terminate server process?

I just created automation sending an email using a shell script, but it always running and send me an email every sec to my email. I'm using PID and that process name to terminate it, I'm writing ...
0
votes
0answers
21 views

Bash question with system processes? Stopping and renicing “Java” processes

I play minecraft on linux, and I would like to make a Bash script that does two things. First, I would like it to close the minecraft launcher's process. Secondly, I would like it to renice the ...
0
votes
1answer
20 views

How to auto load source file on bash startup?

I recently installed Ruby Version Manager (RVM) to make use of the command called compass. Initially it was working find on installation, but now I get a missing error: The program 'compass' can be ...
3
votes
4answers
343 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 ...
0
votes
0answers
20 views

UMS.sh (run as service) on Ubuntu 14.04 won't read configuration file

I'm trying to get my ubuntu 14.04 to run universal media server so I can stream movies to my ps3 (lowest firmware 4.55 unfortunately - unjailbreakable). After much research on the net I was able to ...
9
votes
7answers
3k views

How do I sort by human readable sizes numerically?

for example I have command that shows how much space folder takes du folder | sort -n it works great, however I would like to have human readable form du -h folder however if I do that than I ...
1
vote
1answer
11 views

How to make a application/script available from Bash? [duplicate]

If I want to launch a script (let's say in the home directory I have a file called hi.py) I need to specify the full path: python /home/user/hi.py. But when I want to use mkdir I can simply say: mkdir ...
3
votes
2answers
340 views

Script doesn't work when it is run using '#!/bin/sh'

I have a script that use shebang : #!/bin/sh, but when I run it in my Ubuntu 14.04 terminal, it doesn't work and it says that some lines has unexpected operator. My friend in another computer could ...
2
votes
1answer
45 views

Shell script to move all images excluding ones with size in name using find?

I have a server backup of a WordPress site that has about 1000 images in the uploads directory. When an image was uploaded through WordPress it would create multiple sizes of the image such as: ...
3
votes
2answers
68 views

Redirecting output to a variable?

I'm interesting in directing the output from two commands to a variable. I don't want the output to be displayed on the screen, but instead assigned to a variable within my script so that I can use ...
0
votes
1answer
32 views

/etc/network/if-up.d script with password prompt

I want a script that logs me in when a specific interface uplink was established (university LAN). The thing is I don't want to hardcode my password into the script. Is there any way to prompt for a ...
3
votes
1answer
69 views

Blank line in my bash.history?

I was taking a look at my .bash_history, and I found a blank line. I thought that I could have pressed "enter" while I was taking a look in the file. Is that normal? Or maybe I really pressed enter ...
5
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 ...
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 ...
-1
votes
0answers
13 views

Hadoop gives Error localhost: Error: JAVA_HOME is not set.?

I'm using Ubuntu. I have installed Java Hadoop configured it as single Node. i have also added environmental variable named HADOOP_HOME,JAVA_HOME in .bashrc file. When i was trying to run Hadoop using ...
0
votes
1answer
23 views

show limited git diff status in ls, only in git directories

This might be an odd problem, but I would like to override the behavior of ls when in a git directory. I want to extract some diff statistics from the last commit, and append it to the bottom of the ...
0
votes
1answer
20 views

How to detect if an OpenVPN connection has disconnected?

I have a machine that is connected to a VPN through OpenVPN. Is there a way to detect if the connection has dropped and run a script in the event of the disconnect?
-1
votes
1answer
42 views

Use find command but exclude certain directories [closed]

I am trying to run the make command, but it says
0
votes
2answers
27 views

Set custom added PATH vars to work in each Terminal session

I ran these 2 commands simply in the terminal: export PATH="$PATH:/home/milkncookiez/Developer/android-studio/bin" export PATH="$PATH:/home/milkncookiez/Developer/PhpStorm/bin" in the 2 bin folders ...
4
votes
2answers
78 views

Change current working directory only by typing the name of the new one

Something similar to this Q&A, I know that cd will change current working directory in terminal to a new directory like this: cd /path/to/new_directory But I wonder how can I change current ...
0
votes
1answer
46 views

shuffle filenames inside a folder and place changes in a text file [closed]

I need to shuffle all the files placed inside a folder and keep track of all changes that have been made in a text file. The generated output will be same set of files with new names like ...
0
votes
2answers
38 views

Continous Loops in Bash

I'm interested in writing a program that will get the size of the mail spool file for the user. (The spool files found in /var/spool/mail/$USER on Linux). To do this, I would like to create a ...
1
vote
3answers
76 views

copy n number of files from one folder to another folder

I have a folder of n number of files. I need to move n/2(or)n/3 files from that folder to any other folder. How to set the value of n so that it will move exact those number of files?
1
vote
1answer
27 views

Bash: what is the meaning of ${parameter##word}

I'm working on bash code and I found a function CheckOtherFiles that I guess is used to check if a file ($1) is more recent from file $WS_ROOT/$NomeVista/COMP/COMP_COMPILE. CheckOtherFiles is called ...
0
votes
4answers
33 views

scripting chroot, how to?

So I'm looking at: https://help.ubuntu.com/community/LiveCDCustomizationFromScratch and trying the following within a bash script: sudo chroot chroot mount none -t proc /proc mount none -t sysfs ...
10
votes
2answers
587 views

Why “which” returns none on some commands I can run?

I used which to tell the location of a runnable file. For example, which pwd returns /bin/pwd. However, I found which alias or which compgen etc returns nothing. What are commands like alias? Aren't ...
0
votes
1answer
17 views

Mercurial no color in commands after doing su

First noticed in 12.04 still persists in 14.04 This happens when to change to a system user (www-data, postgres, etc) and not for a user which has a desktop profile setup. What I have tried: Copy ...
0
votes
2answers
33 views

Media Scanner Script

I am a beginner with Bash scripting. I have recently been working on a script to harden Ubuntu computers for a school project. Everything is going well, except that the students are not allowed to ...
27
votes
1answer
1k views

How can I make cowsay say something every time I close the terminal?

I want cowsay to print something like "have a nice day" when I close the terminal. I know I have to have some kind of script, but I'm not even sure how to write a script or how to use it once it's ...
2
votes
2answers
1k views

How to make svn look for if there is an update once a minute and if there is call some script?

I wonder if it is possible to create such .sh script that a normal user would be capable to start with something like nohup ./superScript.sh >& /dev/null & and which would once a minute ...
3
votes
3answers
2k views

Cannot use “./” to execute a shell script

Maybe someone here would be able to help me out. Have installed Ubuntu 12.04 LTS (kubuntu) on two machines. The .bashrc and .bash_profile files are identical as the file structures on each machine is ...
2
votes
2answers
212 views

Run a standard command in bash script

I am writing a bash script to automate several actions: #!/bin/bash echo "Hello, World" NAME="${1}" PATH="${2}" echo $NAME echo $PATH eval "ls" I am going to call ls, ffmpeg and a lot of ...
1
vote
3answers
115 views

script skipping user input in nested case statement

I am trying to create a nested case statement in which user input is expected (Y/N). However, the system never waits for the input and always goes to the third option, "Please answer yes or no". Can ...
0
votes
1answer
20 views

Trying to add timestamp to image but keep getting error unknown image property “%[exif:DateTimeOriginal]”

I want to put timestamps on all images in a directory based on the date created/modified. I've seen a bunch of methods like this and this, but they all use the code %[exif:DateTimeOriginal] which ...
2
votes
3answers
1k views

stop program from terminal if running for more than x seconds

so by typing /.blabla I launch the program blabla. Is there a way, from the terminal, to stop (i.e. equivalent of ctrl+c) blabla has been running for more than x secs? (I'm trying to test a ...
12
votes
2answers
1k views

Can I create a separate bash history file for each terminal profile?

I use a bash script to start gnome-terminal with multiple tabs, each tab using a different profile, working directory, and in some cases executing a command within the tab. In this situation, I'd ...
3
votes
1answer
337 views

How do I delete all pop/rap music?

I have all the music stored in ~/Music and I want to delete all pop music (or it could be a different genre). I was thinking to look the song metadata to check and see if a song is pop, and then ...
0
votes
1answer
96 views

Add custom script to PATH

I know there are quite some answers about that, but still could not make my way around it. I read all this and tried to follow the example under System-wide environment variables (for my case of ...
1
vote
2answers
307 views

sed “Permission denied” and “No such file or directory” errors while building Clockwordmod

Whenever I execute the command build/tools/device/mkvendor.sh samsung_aegis2vzw /your/path/to/the/boot.img I get this as the output build/tools/device/mkvendor.sh: line 83: /sedcommand: ...
33
votes
6answers
29k views

/etc/profile not being sourced

For 11.04, I did a fresh install of my system. Part of that install was to install rvm, which sticks a rvm.sh in /etc/profile.d/. This doesn't work as /etc/profile (which loads each +r in ...
-1
votes
1answer
64 views

Can't type letter 'm' in bash

My current BASH version is 4.2.45(1)-release. I can't type letter 'm' in terminal. Tried using various terminals. Even copy-paste is not working.(Plz Visit this page before u comment)
2
votes
1answer
58 views

Rename all files in subdirecories

I am having a problem writing a script for mass renaming of files in subdirectories. I have a folder with multiple subfolders, and those subfolders have multiple files that I need to rename. This is ...