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

learn more… | top users | synonyms (1)

0
votes
1answer
23 views

ENV variable within an ENV variable in upstart script

I'm trying to include one ENV var in another in my upstart script: env CONFIG_NODE_NAME=my_$HOSTNAME_node But it doesn't translate it, it just keeps it as $HOSTNAME.
1
vote
1answer
119 views

Run multiple line as a single line command bash

Is there any way to run multiple line as a single line command in bash script. This is my multiple line bash script id=15; if [ $id -ge 30 ] then echo Successful echo $id else echo fail echo $id fi ...
0
votes
2answers
43 views

How can I know which file is being used in a bash for loop?

I have a very tricky question that I have been wanting to tackle for quite some time. If $line is from $(cat foo), then do action1 If $line is from $(cat bar), then do action2 for line in $(cat ...
1
vote
1answer
13 views

Script to generate thumbs only if thumb doesn't exist

I have a working script to generate thumbs to all pdf files in a folder( using Image Magic): for f in *.pdf; do convert -thumbnail 250x200 "$f"[0]"_thumb_wd_${f%.pdf}.jpg"; done How can i adjust ...
2
votes
3answers
156 views

Creating a folder based on a portion of a file name

I have several files named such: KILN_SDUS51_N0SILN_201203020003 KILN_SDUS51_N0QILN_201203020003 KILN_SDUS51_N0RILN_201203020003 I need to file all of them into folders based on the three ...
3
votes
2answers
105 views

How move the biggest file in each subdirectory to current directory?

I like to loop though subdirectories and more the biggest file to its parent and then delete the folder. I have tried many things but never got it working correctly. It says that mv cant find the ...
2
votes
1answer
17 views

antlr4 alias not persisting

I'm trying to set up Antlr 4.5 as per the instructions here but the alias isn't accessible from where I've put my project after a reboot, which makes me wonder if I've done the classpath step ...
1
vote
2answers
167 views

split large file in bash

How can I pass all files in a list.txt which looks like file1_1.txt file1_2.txt file1_3.txt file1_4.txt to the split command (there are other txt files in the dir) and make it return the parts ...
1
vote
1answer
44 views

script sh syntax error

I have this script: #!/bin/bash IP='192.168.1.1' fping -c1 -t300 $IP 2>/dev/null 1>/dev/null if [ "$?" = 0 ] then echo "Host found" else echo "Host not found" fi When I try to run it, ...
1
vote
1answer
29 views

cannot change directory with script [duplicate]

I tried the following script to give myself convenience in changing directories to different hard disk partitions. But after its execution, the default location does not change, but if I use command ...
1
vote
0answers
18 views

Terminal Closes On Running clear and large output commands

When I run the clear command or ctrl+L or commands with large output like ps aux, my terminal closes. I have set the scrollback to unlimited.
0
votes
0answers
22 views

Xinput command in autorun script doesn't execute

I use two monitors 15 inch and 19 inch. With the 15 inch I also use a touchscreen. I have to map touch events to 15 inch monitor with this command: xinput map-to-output 11 VGA1 11 stands for id ...
1
vote
2answers
73 views

Shell script does not run when I double click

I have made a shell script (test.sh) on my Lubuntu (15.04) desktop. Permissions are: Only owner (View content + Change content + Execute). When I double click test.sh, I choose "Execute in Terminal". ...
1
vote
2answers
41 views

error while cron scheduling a sh script

This is my shell script which i want to schedule using cron job. parser.sh #!/bin/bash source .profile workon venv cd /home/ashish/deployments/myproject export ...
3
votes
2answers
70 views

bash: script/bash_completion_dog: No such file or directory

When I open my terminal, I get this message. I tried to correct my .bashrc file but could not find anything related to this error message. How do I resolve this? As suggested by terdon, I tried the ...
0
votes
3answers
28 views

How to Verify JAVA_HOME path

I installed java in opt/jdk1.7.75 having following directories--> bin db include jre lib man COPYRIGHT LICENSE README.html relase & other files I set JAVA_HOME path in .bashrc file as follow: ...
1
vote
1answer
28 views

Where is the manpage of the set builtin? [duplicate]

When I type the command man set It gives the postgresql 9.3.6 manpage documentation of the set command. (May be I need to precise that I have postgres installed in my machine). However, I am not ...
1
vote
1answer
25 views

How to create log file from a command (through alias)

The call is simply ud typed in a terminal. ud is defined as the following in my ~/.bash_aliases: alias ud='sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade ...
3
votes
2answers
54 views

Ctrl+C command is not terminating infinite (while) loop

I have this little script. When I start it and the terminal has the focus Ctrl+C stops feh and then the while loop starts feh again. I am expecting that, as long as the terminal(!) has the focus, ...
5
votes
8answers
486 views

How can I delete text that is NOT in quotes or parentheses?

Input: 19. "foo foo" (bar bar) (19) raboof "foo foo" raboof Expected output: "foo foo" (bar bar) (19) "foo foo" As you can see, I would like to keep the double quotes and parentheses. ...
5
votes
5answers
566 views

What can I do in order to change the “.33” value into “0.33”?

I want to compare the value against 0 and it tells me that it is less than 0. I used solution=`echo $a / $b | bc -l` This issue occurs only when "a" is less than "b".
5
votes
1answer
74 views

How to make reverse-i-search in terminal easier using comments?

When you press Ctrl+r in terminal this leads to use the reverse-incremental-search mode. The reverse-i-search lets you search for previous commands in your terminal, but this can get confusing when ...
2
votes
3answers
154 views

Regex Conversion

I'm wanting to make a command to edit /etc/default/grub and change the timeout from 10 to 2. Could anyone explain how to do this?
12
votes
4answers
317 views

How can I merge files on a line by line basis?

cat file1 foo ice two cat file2 bar cream hundred Desired output: foobar icecream twohundred I already have a solution involving a for loop with sed using the line number of the files, but in ...
4
votes
4answers
145 views

How can I extract text between parentheses containing a specific word?

How can I convert this: foo (blah) (bar 80) foo (cats) (blat 92) To this: foo bar 80 foo blat 92 I would like to keep all the text that is NOT in parentheses. I only want to extract text ...
2
votes
1answer
26 views

Gnome-terminal not working properly with screen-256colors

Today I noticed I did not have 256 color support in Weechat. I decided this would be a quick fix. It isn't. First thing I googled was how to test the color support in terminal. I have installed ...
0
votes
3answers
51 views

How to create desktop shortcut to bash program running java

I've downloaded the free and open-source image analysis software "Icy" (http://icy.bioimageanalysis.org/), and I can launch it by making the "icy.sh" file executable and double-clicking on it. ...
1
vote
1answer
34 views

How can I list mp3 files that have a leading period?

I have mp3 files in a directory. For this example, let's assume they are these 3: Enter Sandman.mp3 ...And Justice For All.mp3 St. Anger.mp3 How can I list (ls is highly preferred) all ...
0
votes
2answers
27 views

aliases not picked up when sudo in mac? [on hold]

I have the following aliases in /etc/profile. # System-wide .profile for sh(1) if [ -x /usr/libexec/path_helper ]; then eval `/usr/libexec/path_helper -s` fi if [ "${BASH-no}" != "no" ]; ...
4
votes
2answers
55 views

useradd doesn't allow the user to log on

On an Ubuntu 14.04.2 LTS the following command: adduser fu and then entering a password bar and just pressing Enter on all other questions, creates a user that allows me to log on and has the ...
-2
votes
1answer
18 views

Zenity is not displaying the GUI results in the bash script. The same script is displaying results successfully in Redhat [closed]

ALERT=10 df -h|grep -i dev|grep -vE '^Filesystem|proc|none|tmpfs|udev' |awk '{print $1 " " $5 " " $6}' |while read output do partition=$(echo $output | awk '{print $1}') usage=$(echo $output | ...
0
votes
1answer
27 views

Is it possible to edit the .bash_login file for the second time?

I accidentally wrote an error command in the .bash_login file. I need to edit the file to solve this problem but I can't do that anymore. The error is about the .bash_login isn't a writable file ...
5
votes
1answer
242 views

Getting the default text editor used in system

I have been searching and browsing for a long time and have not been able to find an answer to my question. I have used select-editor and I note that I am using /usr/bin/nano. Is this the default ...
1
vote
2answers
22 views

Need my random effects to show the full line

I am working on a script for random predictions and unfortunately instead of the script taking the full lines from the two random lists (Things and Effects) it prints a random word from each. Can ...
1
vote
2answers
54 views

Command to Combine text 100 lines at a time

I have a file with 7000 lines. I need to combine the lines 100 at a time to reduce it to 70 lines i.e line 1 line 2 line 3 ... line 7000 becomes line 1 line 2 line 3 line 4 ... line 100 line 101 ...
0
votes
1answer
14 views

Bash sed to read auth into debconf-set-selections for Vagrant VM

I have a Vagrantfile that uses a bash script to set up a VM. I can't get the script to set a password for MySQL using debconf-set-selections with output from an .auth file. Below is an example of the ...
5
votes
1answer
112 views

Bash always evaluate Regex as true

In a script, there's these lines #!/bin/bash ... if ! [[ $SCREEN_NAME =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo "The Server title contains invalid symbole. Only a-z A-Z 0-9 - _ . are allowed" exit 1; ...
1
vote
2answers
32 views

parsing out in bash

my file looks like this // [297]((((21:0.125204,20:0.125204):0.00994299,(28:0.0790047,(7:0.0146105,5:0.0146105):0.0643943):0.0561423):0 segsites: positions: 1 2 4 6 9 10 45 67 78 89 ...
1
vote
2answers
35 views

Help with reminder script in Bash

I have stacked trying to make a simple reminder script which can compare the running date with the date that a file has. for example I have a file that contains: Apr 25 2015 cycling \n Apr 26 2015 ...
1
vote
2answers
110 views

bash: ./name.exe: Permission denied

I want to execute a program in Ubuntu 12.04...but when I type ./programname.exe it makes error: bash: ./gbat.exe: Permission denied and I typed "chmod +x programname.exe" , but it doesn't fix ...
2
votes
1answer
158 views

How to automatically answer interactive cli program (not script) with bash script?

I've googled this, and almost all I could find is to answer a bash script and this doesn't work for me. The answers I found told to do: echo "yes" | ./script or ./script <<< yes or ...
5
votes
5answers
264 views

How can I edit a range of text between 2 symbols? awk, sed, regex

Using the "*" symbol, (doesn't have to be that one, any special character will do in order to indicate), how can I edit the text from this: *berry straw rasp blue boysen * blahblah blahblah blahblah ...
0
votes
0answers
6 views

Install linux-image-$(uname -r) non-interactively

How do I install linux-image-$(uname -r) non-interactively? sudo apt-get -y install linux-image-$(uname -r) The above command will get me past the initial "do you want to install this" prompt, but ...
15
votes
5answers
905 views

Where are commands `fg`, `bg` and `jobs` installed? [duplicate]

fg, bg and jobs are used for job management. And for some reason (maybe it's just me), I'm not able to find where their binaries are nor their manpages (whereis prints no information). which gives no ...
-1
votes
1answer
30 views

How to run bash commands in gnome-pie app launcher

I recently installed gnome pie app launcher and i was trying to edit the individual slices and run a bash command to open eclipse. i'm running the more updated eclipse that i downloaded from ...
2
votes
4answers
304 views

Bash script to rename files in a directory

I am trying to write a script that takes a directory as a command line parameter and iterates over the files in the directory changing their extension to .bu . I thought this would work but I'm ...
1
vote
1answer
38 views

Running Shell Script on Double Click

Okay, I have opened nautilus and edited preferences to ask when I double click an .sh script to run in Terminal. Well, I don't want to use a .desktop file; I want to just simply double click on the ...
7
votes
2answers
303 views

How to use grep output as a path for cd?

How can I pipe grep output as an argument to the cd command? For example: [root@xxx xxx]# pip install django | grep '/usr.*' Requirement already satisfied (use --upgrade to upgrade): django in ...
1
vote
1answer
31 views

Why does the more command not work when bound to a keyboard shortcut?

I have two commands that both work in terminal: notify-send "$(more /home/tim/autest.sh | head -1)" and notify-send "$(cat /home/tim/autest.sh | head -1)" putting them in a script like this: #! ...
1
vote
1answer
23 views

My keyboard shortcut binding does not work with my script

I was trying to bind a keyboard shortcut to my script. I tried binding it to keyboard shortcut from System Settings>Keyboard>Shortcuts>Add Shortcut I added new shortcut and as mentioned in ...