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

learn more… | top users | synonyms (1)

2
votes
2answers
5k 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
177 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
146 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
786 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
4k 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
373 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
739 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
361 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
592 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
352 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
115 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
3
votes
1answer
294 views

How can I test if a variable matches another value and move to another function?

I am writing a script where I store a predetermined line of text into a string (we will call abc). I am storing the results from grep -iqs $USER file (we will call def) into another string. How can ...
0
votes
1answer
2k views

How to fix this problem, where sometimes /dev/video0 becomes automatically /dev/video1 as a result other apps cant read

I have one camera USB which on connect makes a place as /dev/video0, now using other applications while its reading /dev/video0 works fine, after some time like couple of hours later, automatically ...
2
votes
2answers
401 views

Bash script not working properly when run automatically

I have a script that sets my proxy automatically depending upon the connection and so its placed in /etc/network/if-up.d/ folder. I set the proxy using gsettings tool and then I want to show a ...
0
votes
1answer
288 views

Find and exec using pulled variable

So far I have a simple batch script that moves *.mkv files from their source folders to a folder called "Movies". Now I would like FileBot to rename them using the 'find' command, since it (filebot) ...
3
votes
3answers
1k views

Is it possible to get a list of all open files (and the programs being used to view them)?

I want to write a script that obtains a list of all open programs and files, and then generates a shell script to re-open these files. For example, if I were editing the file example.txt using gedit, ...
2
votes
2answers
127 views

Linking bash scripts

Im looking for a way to link some bash scripts. Kinda the way you include php. I wanna have my password.sh ask for pass > launch Utility > Utility checks to see if its correct > if so it will move to ...
14
votes
2answers
5k views

Command for deleting temporary files ending with ~

Many days ago, I found this useful bash alias (contents of my ~/.bash_aliases) # aliases # finds temporary files ending with '~' and deletes them alias rm~='find . -name '*~' -print0 | xargs -0 ...
1
vote
2answers
393 views

kdialog --password used with sudo?

I am using kdialog for a small Utility in making, Now i run into this promblem. There is one or more commbined functions that take sudo 3 or 4 times in a row. So its really annoying to have to enter ...
5
votes
2answers
629 views

Why is there a shell given to user for PostgreSQL?

cat /etc/passwd |grep postgre postgres:x:115:127:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash apt-cache show postgresql Package: postgresql Priority: optional Section: database ...
19
votes
2answers
8k views

In a bash script what does a dot followed by a space and then a path mean?

I came across this example when trying to mount a usb device inside a openvz container and I have never seen the construct in the second line before. Can you explain what it signifies? #!/bin/bash . ...
1
vote
2answers
295 views

how to reverse the lower case characters in word using only sed

Reverse every word of a line using sed Description ----------- The job to do is reversing every word of a line. that a word is a sequence of lowercase alphabets Raw Input ...
4
votes
1answer
126 views

How can I get the authentification dialog programatically?

Instead of using gksudo in a bash script, I want to invoke the authenticate dialog ( as in screenshot) instead. Is it possible? If yes, how? Thanks.
4
votes
3answers
37k views

How to separate fields with space or tab in awk

While playing with awk I came to execute: ls -la >> a.txt ; awk {'print $5 $1'} a.txt ; This is giving output like: 53277-rw------- 52347-rw------- How can I get a space between these two ...
2
votes
3answers
59 views

Open all files in project with long lines in an editor

I'd like to edit all text files under a certain directory that have one or more lines that are over a certain threshold in length. How can I do that? To keep things simple, let's assume that all the ...
2
votes
1answer
113 views

Why command line completion doesn't work anymore with “:>”?

I've got a file called (for example) myApp.log. On a 12.04 system I could enter :> my followed by the tab key and the rest of the filename would be filled in (or if more than 1 file with a ...
6
votes
2answers
3k views

“No such file” when running a 32-bit program on a 64-bit system

I downloaded a Chromium snapshot and unzipped it, like this: michael@ubuntu:/opt/chrome-linux$ ls chrome libffmpegsumo.so nacl_irt_x86_32.nexe chrome.1 ...
1
vote
1answer
2k views

Terminal not configured - not showing folder, no tab completion, etc

I access via ssh (command line) a linux machine and the user is not configured to do anything. Backspace does not work, there is no tab completion, the current folder does not appear in the terminal ...
0
votes
2answers
413 views

Error while running bash script that moves files

I am new to bash script and want to create bash script that moves some days old files between source and destination as per days defined in script. When I run this script I get error find: paths ...
8
votes
2answers
941 views

Make directory named 0001 instead of 1 in a bash script loop

In the following bash script if j=0000 how have I to change the following bash script to make dirs named 0001, 0002, ...? Actually it make dirs named 1, 2, 3 for i in *.jpg; do let j+=1 ; mkdir $j ; ...
0
votes
1answer
934 views

Bash script using eyeD3 to remove extra tags from mp3 files

I found what looks like the perfect script for this but getting errors. Hoping someone can see problem. I am running 12.04 Server. Error is awk: line 0: regular expression compile failed (missing ...
6
votes
2answers
7k views

How to pass results of bc to a variable

I'm writing a script and I would like to pass the results from bc into a variable. I've declared 2 variables (var1 and var2) and have given them values. In my script I want to pass the results from ...
2
votes
3answers
2k views

How to find out where $MANPATH is set?

How can I find out in which configuration file the environment variable $MANPATH is set? Is there a way to backtrace the values? I am aware of that I can grep through the whole file system using find ...
0
votes
1answer
428 views

background process outputs to the console

Suppose test.sh is a bash script that is empty or contains only exit 0. When the script is backgrounded, what is the significance of the 1 and 16320 printed to the console? ...
6
votes
1answer
156 views

Conflict between variable substitution and CJK characters in BASH

I encountered a problem with variable substitution in the BASH shell. Say you define a variable a. Then the command $> echo ${a//[0-4]/} prints its value with all the numbers ranged ...
3
votes
2answers
1k views

Bash script won't stay open in background after running through while

I can't get the following bash script to stay open after the first message is received from NC: #!/bin/bash port=3333 nc -l $port | while read msg; do notify-send Alert "$msg"; done After the first ...
5
votes
1answer
152 views

Preventing Users/Groups from accessing certain Domains

I have created a Study account which I use when doing anything school related work. It's purpose is to remove the distractions of my normal account, such as social media and news websites. I know ...
1
vote
2answers
578 views

Why does my terminal attempt to execute 'sudo apt-get update' at every launch?

Every time I launch a terminal it attempts to execute sudo apt-get update This happens regardless of which terminal emulator is used - both guake and gnome-terminal do it at least. It also does ...
4
votes
1answer
267 views

Function inside .profile results in no log-in

I've created a custom function in my .profile, and I've added right at the bottom, after my custom aliases : # custom functions function eclipse-gtk { cd ~/development/eclipse-juno ...
5
votes
3answers
2k views

Searching for executable files

Is there a way to search and delete all executables files within folder if there is no extension? e.g Let's suppose I have 4 files with .ubu extension and the following bash does the job I'm asking ...
1
vote
1answer
250 views

bash substring syntax as a means of disambiguating environment variable identifiers

When bashing, I know that double quoting is sometimes necessary if an environment variable (EV) contains embedded spaces. Example: "$JACK" rather than $JACK. Sometimes it is recommended to use the ...
5
votes
2answers
237 views

How to set default applications non-interactively (e.g. vlc as default for video)?

It's straightforward to set vlc as default using the GUI, but straightforward doesn't mean easy(I have to do the same thing over and over many times each time I install a new system). I just need a ...