Tagged Questions

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

learn more… | top users | synonyms (1)

3
votes
4answers
232 views

making a bash script executable programatically

I need to create a bash script to create and mount a drive. So, two simple commands. Both "work" when entered at the command line. The script is created and executed every time a normal user logs in, ...
3
votes
3answers
261 views

Special variables in bash

I know these are few special variable used by bash. But I am not able to understand it. Can anyone explain me what are these variable and how to use it? $* $@ $#
0
votes
0answers
48 views

wait for job in bash script

find /var/www/ -ipath */logs/access.log.gz -execdir mv "{}" "old/`date +\%G-\%m-\%d`-access.log.gz" \; wait service nginx reload wait python /var/www/default/piwik/misc/log-analytics/import_logs.py ...
1
vote
1answer
43 views

Shell Script Problem

I decided to make a shell script for basic nmap scanning so I did it like this : #!/bin/bash sudo apt-get install nmap printf "enter the name of site to do basic scan on >>>" read NAME ...
1
vote
3answers
23 views

Wildcard: return source path

I'm trying to rename every access.log.gz file (note: exact filename, not "beginning with" or "containing") found in /home/*/logs to date-access.log.gz in the same folder. for file in ...
0
votes
2answers
98 views

Bash error on opening the terminal

Whenever I open terminal in Ubuntu I get the following bash and I don't know how to solve it. I need a solution as soon as possible: bash: ...
0
votes
1answer
386 views

“Syntax error: Unterminated quoted string”

I am trying to use a backup script that will backup my sql database and website files. I am running Ubuntu 12.04 32 bit version and zPanel. Here is what my DB structure is along with which DB I want ...
1
vote
1answer
125 views

Bash script for multiple tabs program running

I have the following bash script code to open multiple session of a python script with different input argument in different terminal tabs. #!/bin/bash cd /home/me/experiment tab=" ...
2
votes
0answers
125 views

Shell command not asking for password inside while loop [closed]

I am trying to run .sh file to put certificate via keytool command in every jre/lib/security/cacert file described in ~/.java/deployment/deployment.properties file. #!/bin/bash ...
2
votes
1answer
165 views

Bash script that opens multiple netcat instances and exits them

I am trying to create a script that opens up multiple gnome-terminals and opens a netcat connection. After a couple seconds I would like the terminals to close. I am at a loss and I believe it can't ...
0
votes
1answer
31 views

combine multible commands in one run one of them is find

I want in one line a command to use find to get a file name from a txt file , search for it , and play it then after closing the video I need to run a certain script I managed the first part but ...
1
vote
1answer
58 views

Why won't this php script execute bash script?

Why am I not able to execute this bash script using php? I have tried exec() as well as shell_exec(). index.php <?php $old = getcwd(); echo $old; chdir($old); $message=exec("a.sh"); ...
0
votes
2answers
56 views

gnome-terminal profile without bash history

I'm trying to create a profile in gnome-terminal that doesn't store bash history. The easiest way to do that is to run export HISTIGNORE="*", but there is one problem, gome-terminal is executing ...
1
vote
2answers
399 views

Why isn't one 'bash' command working at startup

I am working on a VM with Lubuntu 14.04, I have created a script a.sh, #!bin/bash echo "aaaa" >> a.txt And my /etc/rc.local file is as follows: #!/bin/sh -e # # rc.local # # This script is ...
-2
votes
4answers
101 views

How to arrange this file properly?

I'd prefer to edit TestFile in place to get the desired output. How could I do this? This is a work box so I'd prefer to not have to install additional packages. TestFile: randomcollege-nt\jsmith90 ...
1
vote
3answers
344 views

How to kill a script running in terminal, without closing terminal (Ctrl + C doesn't work)?

I have written a bash script that calls several other programs and executes a bunch of commands. I run this script from the terminal. Now I want to kill the script. Pressing Ctrl + C sometimes ...
-1
votes
1answer
116 views

Run pkill without sudo permission

I want to run pkill like below. sudo pkill -u 11002 I cannot give sudo password multiple times, so I want to run pkill without sudo user. For this i copied pkill to home as named bkill, and then i ...
0
votes
1answer
145 views

Script that ssh to remote host enters pass and executes a command?

Is it possible to make a script that ssh to remote host, enters the passwords to log-in and then executes at least 1 command on the remote machine?
1
vote
1answer
64 views

Question about something appearing in my Terminal

After I moved from Windows to Ubuntu I liked to try out every new app I found so I decided to install Betty (a Siri like alternative for Ubuntu). I used the PPA given by Webupd8 site and the last ...
0
votes
0answers
97 views

Prevent *buntu from updating dictionaries during install

In utilizing Vagrant to install an Ubuntu server box with a GUI (lxde), the shell provisioning fails due to what seems to be a frequent issue when setting up dictionaries. The resolutions seem to all ...
1
vote
0answers
38 views

xdotool for writing a preformated command in bash [closed]

when I run prompt$ xdotool type 'find -iname "**"' I get this find -iname "**"prompt$ find -iname "**" how could I have that prompt$ find -iname "**" I use xdotool to fill the command line ...
-1
votes
1answer
32 views

is source code for bash sufficient, when I want source code of ext4?

when I want to know the source code of ext4-filesystem (mkfs.ext4) - is it then sufficient to download the source code for bash ? - or do I need else source-codes after I did : sudo apt-get ...
0
votes
1answer
43 views

awk: runaway regular expression

I can run command on ubuntu: free | grep Mem | awk '{print $3/$2 * 100.0}' And get result: 20.1092 But when I try to put it in alias: alias memTotal="free | grep Mem | awk '{print $3/$2 * ...
0
votes
1answer
25 views

Paging standard out using 'more', and piping to syslog

I've implemented a wrapper script which causes all commands executed via this wrapper script to log (via rsyslog) things such as the execution time, the user that ran the command, and the exit code. ...
0
votes
2answers
97 views

Bash tries to run python on unknown command and fails in Py_Initialize

Running Ubuntu 14.04 and updater says that all software is up to date. Have tried rebooting. I am preparing for a class that uses Python. I have installed it and it works fine. However, I now have ...
0
votes
1answer
53 views

Getting “no such file or directory” bash error when trying to compile a file

I have already checked out the many similar questions on this website, but I keep getting this error when trying to run my program conversion.cpp with ./conversion. The program is here: (i can't ...
1
vote
2answers
122 views

.desktop file doesn't execute a script, works fine when run by hand

I am having problems with my .desktop files. I have a shell script that constantly watches for a file to be put into the "Downloads" folder. When a file is put into the folder it automatically ...
0
votes
1answer
71 views

How to run correctly bash script from another script?

I want to run sqldeveloper on Ubuntu Gnome 14.04. I created some symbolic link and tried to call from one script file another. And it fail with message: /usr/local/bin/sqldeveloper: line 2: ...
0
votes
0answers
66 views

Get file created by a program launched by a bash script

I have the next scripts: | base_dir/ | - test.sh | | tests/ | | - elaborato.sh test.sh run elaborato.sh elaborato.sh could create a file (not always it create a file). I need : to know the ...
2
votes
1answer
247 views

How to get PID of shell running in a terminal window under mouse?

Though similar questions asked before in this forum here , here and here, my question is different. I want to get PID of a running bash process in gnome terminal. Note: Suggested link which posted ...
0
votes
2answers
112 views

Autostart program whenever a file is added to the Downloads folder

I have Lubuntu 14.04 LTS on my laptop for a few weeks now. I have been working on customizing the OS and such quite a bit, as well as installing everything that I need for daily usage. One thing I did ...
0
votes
1answer
90 views

Writing a bash script to execute/automate install of drivers

i'm trying to write a script to automate the install of TV card drivers (for some reason i have to re-install after each ubuntu update). Would this work? I've tried it but it doesn't look like it's ...
0
votes
0answers
15 views

Problem during the usage of up and down keys for checking up and down arrows

I am facing an issue during the usage of up and down on gnome-terminal. Lets say my previous commands are vi pos_of_rightmost_setbit.cpp gcc -o harsha pos_of_rightmost_setbit.cpp At this point ...
1
vote
1answer
43 views

Desktop shortcut doesn't work for script but script work fine

#!/bin/bash/ ls -1 *.mp3 > playlist.m3u for (( ; ; )) do mplayer -playlist playlist.m3u; sleep 0.1; done This is the script and it works ! [Desktop Entry] Version=1.0 Type=Application Name=Play ...
0
votes
0answers
56 views

bash: Permission Denied when I move my CPP file to another location

I crafted a test CPP programme. It created a file in the home directory. It compiled with ease, and I could run it by typing ./rocketfire in the Terminal. Now, I did these: abhimanyu@AbhimanyuPC:~$ ...
2
votes
2answers
226 views

How do I get `tr` command to ignore newline?

I want to replace multiple spaces by a single space. I am using tr to do this. But it is also replacing new line with a space. How can I avoid it? Code: tr -s [:space:] ' ' Input: He llo Wor ld ...
6
votes
2answers
374 views

Why do I get different outputs in case of sh and bash?

I have the following simple script: #!/bin/bash echo "Bash version ${BASH_VERSION}..." for i in {1..99..2} do echo $i done Output in case I run with sh file.sh: Bash version ... {1..99..2} ...
1
vote
1answer
67 views

BASH script for extracting archives - how to make the script ask for folder destination?

I've started using the bash script below, for unpacking archives. How would I go about making the script ask if I would like to specify a folder, or just use the default folder to extract to? I'd ...
1
vote
2answers
108 views

Changing environment variables

I just changed my /etc/environment file to: M2_HOME=/usr/local/apache-maven/apache-maven-3.1.1 M2=$M2_HOME/bin ...
1
vote
2answers
283 views

How to get a colored bash?

How to get the bash colored like this?
-1
votes
2answers
46 views

in a file match a stringa and print lines matching another stringb

Basically , i have a large file with more than 5000 lines in the following format Below snip given two blocks of the entire file. What i need is to search for given String name (eg: abcd etc) , and ...
0
votes
1answer
28 views

Redirect input from file

I'm writing a script (TEST.sh) that must run another script (TASK.sh)... Task.sh need two input... so I was thinking to redirect input from a file (I need to automize everything)... So, I was using ...
4
votes
1answer
75 views

Way of receiving alerts on login attempts, whether successful or not?

I believe my linux machine to be reasonably protected from external login. But since I am mildy paranoid, I would like to be alerted when there is a login attempt made to the server, whether ...
1
vote
2answers
72 views

Automatic screen capture script

I'm looking to accomlish exactly what Anwar Shah describes here Bash script to take screenshot and save the image - Ubuntu with the added functionality of setting a time increment for the script to ...
0
votes
1answer
26 views

Convert fb2 to txt

There are still a lot of devices that can't read fb2 and able to read txt. Also, txt version could take much less space compared to uncompressed fb2.
0
votes
1answer
110 views

Is sim a shell script command?

I was creating a sym-link for practice in Ubuntu 14.04. I meant to use this command: ln -s ../fun dir1/fun-sym It was taken from a book I am using. Except I used sim at the end by mistake. So the ...
0
votes
2answers
181 views

setting up a script to rotate scren Lenovo Yoga Thinkpad S1

I am trying to set up a Lenovo Yoga Thinkpad S1 to rotate the screen with the touch of a button but I am having a little trouble with the script that actually does the work. I have found the scripts ...
1
vote
1answer
115 views

How to disable notifications sound while XBMC is runnig?

I would like to know if it's possible to disable notification using XBMC (mails, network etc). I'm using Kubuntu 14.04.1. I've found this command but the script doesn't work, the sound is re-enabled ...
2
votes
0answers
121 views

Slow bash tab completion

My bash shell's tab completion is very slow, usually taking 1-2 seconds per completion. This only seems to happen when I'm using my laptop from work. Tab completion is very speedy when using my laptop ...
0
votes
1answer
39 views

Simple bash script not working

I'm pretty new to bash scripting. I'm trying to make a script to export the http_proxy variables. This is what I do from the terminal: $export http_proxy=http://proxy21.iitd.ernet.in:3128/ $export ...