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

learn more… | top users | synonyms (1)

3
votes
0answers
380 views

msmtp not working?

I was trying to send mail from bash, but it doesn't work and I can't find the reason... So my .msmtprc file is account default host smtp.gmail.com port 587 from account@gmail.com tls on tls_starttls ...
3
votes
1answer
1k views

How to execute a script before login screen?

I would like to know , how can I run scripts before the login screen.I mean My script should start running before login screen will appear.How can I achieve that?. I am the root user of that PC. ...
1
vote
2answers
1k views

bash and c - 2 processes in concurrency to write a file

I made a C program, it forks 2 processes and each one of them uses system() to call 2 scripts (script1.sh and script2.sh), what I want to do is let them write in a file (output.txt) in parallel ...
1
vote
1answer
28 views

Where to publish useful customised functions

I have started to write a customise function, that encapsulates a bunch of actions that make my daily work easier. A few questions about sharing the function with the community: What would be the ...
6
votes
4answers
4k views

How to determine status of upstart job in bash script?

How do you determine if an upstart job is running inside of a Bash script? That is I need a "boolean" value to do something like: #!/bin/bash if [ determine_if_job_x_is_running ]; then echo "I see ...
9
votes
3answers
3k views

Long lines overlap in Bash PS1 customized prompt

I have configured a fancy two-line PS1 bash prompt, with server name, time, user name and other useful variables. PS1="\n\[\033[1;34m\]\342\226\210\342\226\210 \u @ $SERVER_NAME""$BBlue"" ...
3
votes
3answers
900 views

how to avoid space in filename?

I have a bunch of files which need to be converted from .mp4 to .mpeg.one. A friend of mine had suggested me this simple script. However it doesn't work because filenames contain blank spaces. Here ...
3
votes
2answers
2k views

Auto confirm when running bash scripts?

I am working on a simple bash script that configures new servers how I want them. It's nothing special but it will hopefully save me quite a lot of time in the future. How do I prevent prompts like ...
0
votes
4answers
155 views

Counting files per owner recursively

From an entire directory structure I would like to output all the owners and how many files belong to each owner. I would like an output like this: +-------+-----+ | alex | 3 | | liza | 345 | | ...
1
vote
3answers
603 views

Bash script generating image from video with specific title in subdirs

I have the following bash script generating a jpg file with the same name of the video file. Now I need to change the bash script to generate the jpg file with the name image.jpg instead of with the ...
4
votes
2answers
2k views

What is the life of an infinite loop send to background?

When will an infinite loop end? E.g. if I run while :; do sleep 1; date +%s; done & when will this end — on closing the terminal or on shutdown?
1
vote
1answer
651 views

Zenity alternative for Bash scripts in package sources?

Zenity is a bit too limited for my use cases. What are the alternatives? It must be inside package sources, and it must be useable from within Bash scripts.
2
votes
2answers
703 views

How to list available space excluding mount points in home directories?

I ran df -lP which gave me the following output: Filesystem Size Used Avail Use% Mounted on /dev/sda1 7.6G 2.2G 5.1G 30% / varrun 506M 108K 506M 1% ...
4
votes
1answer
720 views

Custom command to open VLC with some options

I am trying to create a script to run vlc to play (or queue if a playlist is already present) some videos. so far in my ~/bin/ folder I have created a file ``myvlc'' with the following command: ...
3
votes
1answer
129 views

Bash - Get Sudoer Username?

Say I have the following bash script: #!/bin/bash echo $( whoami ) This is what it outputs with and without sudo: alix@netbook:~$ ./test.sh alix alix@netbook:~$ sudo ./test.sh root The script ...
4
votes
1answer
9k views

Run program from a shell script but behave as one process only?

Is there a way I can execute an application from a shell script but not create another process. I want it to look like one process only. It doesn't matter whether my shell script is replaced by a new ...
0
votes
1answer
615 views

What is the best way to add some configuration to bashrc?

I'm currently trying to configure a server using Precise Pangolin and Vagrant (a software allowing me to provision a number of software when booting my VM). My current question is a pure bash one. ...
1
vote
1answer
208 views

Create DSL connection using Bash Script and connect using the same

I have been using ubuntu live OS everyday as my internal hard drive has gone for replacement. On every boot up i need to create a DSL connection to connect to the internet which is a mundane task. I ...
18
votes
1answer
1k views

Why use env in shebang?

What is the purpose of using #!/usr/bin/env <sh|bash|python> shebang compared to #!/bin/bash, #!/bin/sh or #!/usr/bin/python?
2
votes
4answers
8k views

Init.d startup script not working for No-IP

I have just installed No-IP on a brand new Ubuntu 12.04 install. The program starts fine when I start it from the CLI, but if I try to make this startup script work it won't start. I got this script ...
1
vote
1answer
3k views

How to force quit out of an infinite loop in a bash script gracefully

I wrote a bash script that logs keycodes in a simple file. I have put the code in a while loop because I want it to log continuosly. But if I run the bash script in the terminal, the cursor just keeps ...
0
votes
1answer
250 views

How can I execute scripts as root without pointing to its location?

I tend to use sudo arp-scan --localnet --interface wlan0 a lot, but I find it cumbersome to type this each time. To speed things up, I've created a script, called arp-lw-scan, which should do this for ...
-2
votes
1answer
207 views

bat file to batch? [closed]

hello i would like to know if its possible to turn this batch file into a working basfile for ubuntu, im completely new to all this. It works on a windows machine but it does not work on ubuntu. I ...
1
vote
1answer
3k views

How do I remove files as a result of the find command?

I want to rm all the files that I get when I run find search-3S-beta |grep "\.log\." What would be the command?
1
vote
1answer
250 views

Disabling bash history index in terminal

When I SSH into somewhere, I see something line this in the terminal: [504]% Looking it up, looks like its my bash shell history. How can I disable this index display and show the current working ...
7
votes
3answers
4k views

How do I exclude a directory by name using find?

I have a lot of directories on my system, with a structure looking like this: \-----data \------- 001abc \------- 002abc \------- 003abc \------- 004abc \------- ...
1
vote
1answer
758 views

Bash function to open git repository with browser

I'm trying to create a bash function so I can get this. The user, via terminal, goes to the git project path like: /home/daniel/projects/my_super_project So the user will type open and the browser ...
3
votes
4answers
701 views

(Nautilus Scripts) $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; have problems with space

So the script is: #!/bin/bash for line in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do if [[ "$line" = "" || "$line" = " " ]]; then exit else unzip "$line" -d "temp" fi done It ...
1
vote
1answer
629 views

How to Iterate through subdirectories with same name in a path?

I am trying to write a bash script that is iterating through sub directories where parts of the path are identical. Maybe best is to show an example: Directories: /path/same/ /path2/same/ ...
3
votes
1answer
135 views

How to use “read” to enter a directory “cd” to change a file “chmod +x”?

The following Bash script exits after the first read -p line. #!/bin/bash clear echo Put me next to your targeted .sh file! read -p "Press [Enter] key when placed next to target..." echo Type your ...
19
votes
6answers
28k views

Shell script to -9 kill based on name

Is there a way (perhaps a script) how to automate this process: petr@sova:~$ ps -ef | grep middleman petr 18445 2312 1 12:06 pts/2 00:00:01 /home/petr/.rvm/gems/ruby-1.9.3-p362/bin/middleman ...
2
votes
2answers
6k views

Get the default Firefox profile directory from bash

I'm trying to get the profile directory of the default firefox profile (the one that opens automatically) from Bash. How could I proceed? I can't find any useful options issuing firefox --help
2
votes
2answers
185 views

How to use single-thread script to do batch processing?

I have a single-thread python script that gets used like this: python -c "arg" I also have a *.txt file with many arg, each in one single line in the respective *.txt. A text file, say 1.txt ...
2
votes
1answer
147 views

Why does my shell open many instances of itself?

I've been messing with the chsh command so that I could change the name displayed in my shell before each command is issued, for example picard@ubuntu:$. My problem arose when I gave the command chsh ...
6
votes
3answers
806 views

The command 'which cd' prints nothing in 12.04

The command which cd prints nothing. Same for whatis cd and whereis cd. How can I find out if cd is an alias, function, or bash built-in? I'm using Ubuntu 12.04.
50
votes
3answers
5k views

Is #!/bin/sh read by the interpreter?

In bash or sh, I guess anything which starts with # is a comment. But in bash scripts we write: #!/bin/bash And in Python scripts, there is: #!/bin/python Does this mean that # by itself is a ...
1
vote
1answer
379 views

Can I write keyboard shortcut in bash script?

Can I write keyboard shortcut in bash script like: #!bin/bash echo Hello ^z # this is kbd shortcut This didn't work. Is there any other way?
3
votes
1answer
757 views

Ubuntu for phones - is there a terminal similar to the one known from PC's?

I am thinking about install Ubuntu on a phone. I spend a lot of time in terminal while working on my PC. There are much things I do using bash scripts, for example. Then, is there a terminal on ...
4
votes
1answer
2k views

Is it possible to do an unattended/silent lamp installation?

Is there a way to set up and pre-configure a lamp environment within a bash script without user prompting by dpkg and present data like mysql or root user password and such kinds of things?
3
votes
1answer
122 views

Launching a program with several files through terminal expansion problem

I'm making a program that launches vlc with a set of files saved in a variable. But it doesn't work it seems to have a problem with the names, what is weird (for me) is that in the end the problem is ...
5
votes
1answer
1k views

Launch a program keeping focus on terminal

I'm making a script that combines taking input from the command line with the launch of other programs. So the script will go like this: ... launch program Read input from the terminal ... The ...
1
vote
1answer
367 views

Unable to login to bash after editing .bash_profile

I've fiddled around with my .profile and .bash_profile to speed up some stuff: PATH=$PATH:/home/yoshi/android-sdk-linux/platform-tools First I appended the line to my .profile and perfect. Then I've ...
0
votes
1answer
600 views

shell script to install and run [closed]

I am trying to make an automatic installer which downloads file from ftp and installs it on system . Host = "zzz " USER= "ss" PASSWD = " xxXX" FILE = " *.tar" ftp $HOST << EOF user $USER ...
1
vote
1answer
359 views

How to delete unity default launchers

As a part of the system init script, I want to delete default launchers after blank ubuntu desktop installation using bash script. If I delete launchers from the /usr/share/applications it works, but ...
1
vote
2answers
43 views

How to have variable definition in place of command?

I am using chroot in a script, the purpose is to run a command, here is chroot syntax: chroot [OPTION] NEWROOT [COMMAND [ARG]...] The problem is the command I am running needs to take a variable ...
5
votes
5answers
1k views

Service tab-completion broken as root, not even sure where to start looking

On most of our servers, tab completion of service names after typing in the service command no longer works, as root. It works just fine as non-root. This is on Ubuntu 12.04. I'm not even sure where ...
10
votes
2answers
4k views

How do I make bash warn me when overwriting an existing file?

I think the title is pretty self-explanatory. All i want is bash to warn me whenever I attempt to overwrite an existing while using cp or mv. I'd really appreciate some help. :)
0
votes
3answers
119 views

Bash scripting issue for a bifurcation diagram data generation

I'm brand new to this forum (doesn't mean I didn't used it before) but today I've a very important question with wich I found no help on the web. I've a Bash script that doesn't work and I don't know ...
2
votes
2answers
34 views

Run a command when the theme is changed

The command I want the system to run when the user changes the current theme is wallch --changetheme How can I accomplish that?
3
votes
1answer
1k views

How do I batch delete a specific file inside multiple rar archives?

I have about 1000 rar files, that randomly contains an EXE file named:"JPG-Crack.exe". I need to delete it from all archives without harming the other archive content. thanks