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

learn more… | top users | synonyms (1)

0
votes
1answer
80 views

xdotool commands run one by one

I have this bash script: #!/bin/bash function foo() { terminator xdotool type 'myalias' xdotool key Return xdotool key ctrl+shift+t xdotool type 'cd ~/git/apps/myapp/client && ...
3
votes
1answer
89 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 ...
0
votes
1answer
61 views

Use find command but exclude certain directories [closed]

I am trying to run the make command, but it says make: *** No targets specified and no makefile found. Stop. After doing some research, it seems that the error is because I need to run ./configure ...
0
votes
1answer
73 views

Need audio player for bash script

I'm working on a small audiovisual project, and I'm writing an auxiliary bash script to control some stuff. However, I need to play a generated audio file for a few seconds before stopping it, the ...
0
votes
0answers
23 views

Monitoring a screen session

I'm very new to Ubuntu and I haven't really found something that I'm looking for. Basicly I am searching for a bash script that will monitor a screen session based on it's name. As soon as the bash is ...
2
votes
4answers
522 views

Comparing two text files

I have 2 big csv files, file1.csv which looks like this 1,2,3,4 1,4,5,6 1,7,8,9 1,11,13,17 file2.csv which looks like this 1,2,3,4 1,7,8,9 2,4,9,10 13,14,17,18 These are just random numbers that ...
0
votes
1answer
80 views

Make all new .sh file executable

One of my script is making new .sh files in /tmp/ folder how can I setup that all new files in /tmp/ folder will get chmod -x automaticaly because my script is failing when trying to run scripts in ...
1
vote
0answers
58 views

$DISPLAY env var gets cleared at random times

Stock Ubuntu 14.04 Trusty. I seem to regularly experience the $DISPLAY environment variable getting cleared for some reason I don't understand. Basically everything will work just fine until it's ...
-1
votes
2answers
52 views

how can i use command history in a bash file

i try to use "history" command in a bash file .sh but it didnt work with me how can i use it the code of the bash file #!/bin/bash # Copy history to file history #cd ...
0
votes
1answer
92 views

Unable to change brightness using after root access

Case-1 Recently I read a question(Brightness is reset to Maximum on every Restart). Then I opened up my terminal and typed out following command- sudo echo 200 > ...
4
votes
2answers
642 views

How to rename file extension to lowercase?

I know this question has been asked (and answered) before, but it seems my situation is unique, because I cannot have any of the solution to work. Running, I need to rename all my photos from *.JPG ...
0
votes
0answers
110 views

How to use start_daemon to launch a script?

I find start_daemon function in /lib/lsb/init-functions(show below) start_daemon () { local force nice pidfile exec args OPTIND force="" nice=0 pidfile=/dev/null OPTIND=1 ...
1
vote
0answers
31 views

Change content of list in app indicator made using cappind

I made a simple indicator using cappind script which is based on zenity - Webupd8 article Capind page I want to change the text of the list according to some condition.. Like, if the contents are - ...
0
votes
1answer
72 views

Bash Files - /etc/profile vs ~/.bash_profile file [duplicate]

Does anyone know what the difference between the /etc/profile and the ~/.bash_profile file is? Which one is executed first?
0
votes
0answers
59 views

How do I fix this bash script to auto-fix locked eth cards?

One of our servers has an eth1 interface which seems to randomly lock up--but which works again with no issues if this command is issued in the console: ifdown eth1 ; ifup eth1 I wrote a simple ...
0
votes
0answers
41 views

Unable to profile django app

I am trying to profile my Django application. I installed the django-extensions which include a hotshot profiler. I am able to profile using the Django shell. But, I want to create a script for doing ...
0
votes
1answer
40 views

invoke a script on fail of a bash script

I want to run a script that create and host a website with apache server. if anything went wrong I have to rollback all the changes I made, like delete the created folder etc. I know set -e exits ...
0
votes
1answer
290 views

How to make xrandr scrreen resolution permanent?

I create script file name it lightdmxrandr.sh. here is file content: xrandr --newmode "1024x768_60.00" 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync xrandr --addmode LDVS-0 ...
0
votes
1answer
205 views

How can I save lines from terminal to a text file?

I made a simple bash script that pack a file and then upload it, if everything is fine I am getting some http:// links to my stuff as output I want to know how can I copy those links automaticaly to a ...
1
vote
1answer
100 views

Printing footers using enscript

I have a working bash script which converts text files to postscript using enscript 1.6.5.90-2 on Kubuntu 14.04. It does several other things to make the output look better like setting margins, ...
1
vote
3answers
100 views

bash script to check if input has an @

Hi I am trying to write a bash script in which the input is checked to see if it contains an @ symbol, I'm am relatively new to bash so please forgive any/all errors! So far I have: var1="@" ...
1
vote
0answers
80 views

pdsh works well standalone, but doesn't work in script

I am trying to install hadoop via script on my small cluster [introduced in the book: Apache Hadoop Yarn]. I have set up ssh connect without password, and pdsh&pdcp are all fine if I use it alone. ...
1
vote
1answer
50 views

Strang echo behavior

To boil it down: The following command in bash echo $(ssh -t pi@doctor "sudo stat -c \"%U\" /var/www/candy/example/index.html")101 Gives the this result Connection to doctor closed. 101-data ...
-1
votes
3answers
69 views

Create a script that takes a word as an argument from the user

echo "Enter your string" read str; How can I put in a check to make sure the user passed in a word, displaying a usage statement if a word was not passed as an argument.
0
votes
2answers
52 views

if stament in shell script

How write in if [ -z $str1 && -z $str2 ], "&&" doesn't work, if write [ -z $str1 ] this is work. I want to once two string #!/bin/bash echo "Enter first string" read str1 echo ...
0
votes
1answer
24 views

Use gnome-terminal as the Fzf launcher in GVim

How can you use gnome-terminal as the launcher of fzf in GVim instead of the default xterm: https://github.com/junegunn/fzf let g:fzf_launcher = 'xterm -e bash -ic %s' I want to use gnome-terminal ...
0
votes
0answers
61 views

Script problem at boot ubuntu

I have an application in C++ which show a ipcamera video when I send it a value by ethernet. I want that the application start at boot in automatic way. This is my script: #!/bin/sh ...
0
votes
0answers
88 views

Scheduled Cron Back up from EC2 to S3

I have created a script for scheduling sql back ups and store in Amazon S3. Below is the script that I used for taking backups. DATABASES="testdb" testdb_USER=root testdb_PW=root ...
1
vote
1answer
117 views

How to add header file by script? [duplicate]

I want to add a sentence to header of a file using bash script, I tried echo "#define Block $i">>mypro.cpp but it add '#define Block $i' to it's end. Thanks in advance
3
votes
2answers
74 views

How to print the first three digits after the decimal point of a floating number?

I am new to BASH and learnt that both printf and echo write to the standard output. But, I came through the following example which reads an expression from input and computes the result to accuracy ...
1
vote
4answers
499 views

How Can I Run an Shell Script With .desktop Config File?

I am trying to run a shell script with a .desktop file but it doesn't seem to work, producing an error of There was an error launching the application at each attempt. I have the sh and .desktop files ...
1
vote
1answer
159 views

Deleting all files with filenames matching a pattern and size below a certain limit

I need to delete all files with a .avi expansion and whose size is below 100MB. I have a large collection of video files and I need to delete the short ones to free up some space. How do I accomplish ...
1
vote
1answer
245 views

source not reading symlink correctly?

My .bashrc file is a symlink to ~/Scripts/rc/bashrc. This works well for me, and has been for years. However, as of today, this is what I am seeing: bash-4.3$ source .bashrc bash: source: .bashrc: ...
7
votes
4answers
2k views

How can I delete a file if it starts with <html> in bash?

I need a bash command to delete the entire file if the file itself begins with <html>. I'm not sure the best way to go about this... Context: I download a series of files via curl requests. ...
0
votes
1answer
114 views

How to automatically mute on headphones disconnect? Or how to tap bash script to system event listener?

My life would be easier if Ubuntu was muting the sound each time I disconnect the headphones, since every time surrounding is different (example day / night), but the same output volume. I may ...
1
vote
2answers
396 views

bash: using “cut -c” on the strings with spaces like “ ?.?”

i just want to get the third char from watingForHDD. Any idea how to do this? (my idea was to log some data about the used system capacity etc...) #!/bin/bash x="`top -d 1 -n 1`" echo "$x" ...
0
votes
2answers
120 views

How to write a script which automatically presses `Fn + F3` button on my keyboard

I am struggling with screen brightness reset issues . It resets to 100% on every reboot. I have tried searching for solutions but none of them worked[including xbacklight ]. Since I can change ...
3
votes
2answers
307 views

For loop syntax bash script

Is there a way we can implement some thing like this in bash script ? pureips="10.3.1.111 10.3.1.112 10.3.1.114"; pureservers="a b c"; for ip,server in $pureips,$pureservers; do echo "$server | ...
3
votes
1answer
77 views

How to make the terminal autocomplete based on previously entered commands? [duplicate]

It's normal when using terminals that pressing up and down cycles through previous commands entered chronologically. I learned from a site how to add to that behaviour by autocompleting what I'm ...
2
votes
3answers
80 views

SED \n and \ into nothing

The people on this forum have been a tremendous help! Thank you so much! Here is my string ...
0
votes
0answers
64 views

Error in export command in ~/.profile

I have this line in ~/.profile: export PATH=/sbin:/usr/sbin:${PATH} and it is causing this in ~/.xsession-errors: init: gnome-session (Unity) main process (1851) terminated with status 1 And ...
0
votes
1answer
171 views

Help decoding Base64 using base64 -d

**** This post links to Windows-Based malware executables!!! DO NOT EXECUTE DECODED SAMPLE **** I hope I can post this here without having it pulled down. I have 2 seemingly identical base64 ...
1
vote
1answer
85 views

how to make scripts which will run on installation of apt package

I have created a bash script which will store some data into a mysql database. Then I have created deb file with that script and made it available for installation by creating local apt repository. ...
2
votes
2answers
130 views

Displaying TTY name in Terminal name

I am wanting to know how I can display the TTY a terminal is currently using in the window name of the Terminal. I don't see any options in Terminal Preferences to display such thing on the Terminal ...
0
votes
1answer
68 views

Locate two variable strings and write one as a file [closed]

I have a text document that contains 2 lines of information. Line 1 contains a filename, and line 2 contains an reference ID. The document contains additional strings other than the desired ...
1
vote
2answers
858 views

Cannot run bash script from crontab when it works from command line bash

I have a strange problem of being to able to run a bash script from commandline but not from the crontab entry for root. I am running Ubuntu 12.04. * * * * 1-5 root ...
0
votes
0answers
52 views

zip warning: No such file or directory

I have a backup bash script for my Dovecot emails like this sudo zip -y -r -q ~/backup.zip /var/vmail/* -r is for recursive, -q is quiet (since man said that's useful for bash scripts), -y is to ...
0
votes
1answer
224 views

How do I autorun terminal commands at startup in Lubuntu 14.04 LiveCD?

I'm doing some remastering of Lubuntu 14.04 LiveCD, and need to run the following command at startup: /sbin/ifconfig eth0 10.10.10.1 netmask 255.255.0.0 First, I tried modifying rc.local as ...
0
votes
1answer
183 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
1answer
77 views

Starting program via terminal and putting it immidiatly in the bg / bashrc

So i am trying to start a Programm by using the terminal but i also dont want it to be locked to the said terminal. i added an alias inside the bashrc for easy startup: alias tksuite='sudo sh ...