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

learn more… | top users | synonyms (1)

1
vote
1answer
376 views

How can I delete files based on (flac) metadata?

I have several folders with both FLAC 24/96 and 16/44.1 files. I want to delete the 24-bit/96 KHz files, but leave the others. How do I do this from the command line? Is there a way to systematically ...
1
vote
1answer
170 views

enable and disable VPN from bash

I have a number of VPN hosts which I need to access periodically. They are configured and connections work fine off the network manager. I'd like to be able to enable and disable them as needed from ...
13
votes
7answers
99k views

How do I read a variable from a file?

I want to insert in my script a value (string) that I would read from a text file. For example, instead of: echo "Enter your name" read name I want to read a string from another text file so the ...
1
vote
4answers
17k views

While loop help in Shell Script [closed]

I am new to shell scripting so I am curious about using While Loops in Shell Script form. I know how to declare a variable and use a while loop in java int num = 0; while(num <= 10) { ...
1
vote
2answers
3k views

AWK--Comparing the value of two variables in two different files

I have two text files A.txt and B.txt. Each line of A.txt A.txt 100 222 398 B.txt 1 2 103 2 4 5 1026 74 7 8 209 55 10 11 122 78 What I am looking for is an awk command for doing this: ...
4
votes
2answers
10k views

How to configure up arrow to search the history? [duplicate]

How can I configure the ↑ key to get commands from history? Example: If I type p and press ↑ then it should only show commands in the history starting with "p" like python, php, perl, etc. ...
0
votes
1answer
2k views

Crashplan won't install properly

I have downloaded an application called CrashPlan for backups. It comes with the install.sh script below. I ran it but received the following errors. How do i fix this? install.sh: 31: [: x: ...
1
vote
1answer
138 views

How to block all the interrupts in linux

I am working on a python project, Where i am displaying a graphical window with log in screen, I've also disabled the close, re size and minimize buttons My problem: I have to disable all the ...
2
votes
1answer
94 views

Localised Unix shell?

Is it possible to get a localised Unix shell, for example, in japanese, arabic or hebrew? Since it should fit on a CD, I want to save space by using Byobu instead of a GUI. But I would like to have an ...
1
vote
1answer
277 views

How to create a directory for everybody? [duplicate]

I have a lot of music that I want to share with and on all the accounts on my Ubuntu Linux box. I created one in /usr/share/usrmusic changed the user and groups to userx:users and the permissions to ...
4
votes
1answer
7k views

How do I install libusbx library

I am trying to run flashtool (flashing utility for android phones) in ubuntu. Already setup java and appropriate environment On execution the following error comes up rajeswar@WebE-PCl:~$ ...
3
votes
2answers
2k views

Saving more corsor positions (with tput?) in bash terminal

I know that tput sc saves the current cursor position and tput rc restores it exactly where tput sc was called. The problem is that every time tput sc is called, it overwrites the previous saved ...
1
vote
3answers
5k views

Using Fractions/Decimals in Bash Script Ubuntu 12.04

Is there a certain syntax to use while using fractions or decimals in a bash script? I tried using the following script: #!/bin/bash { n=9 echo "$n" for (( i=.5; $i <10; i++ )); do ...
2
votes
2answers
80 views

How to get the directrory name in shell script

I have a script which sets some environment variable to paths: export VAR1=/home/xyz/DIR_IN_WHICH_THIS_FILE_EXISTS export VAR2=$VAR1/abc/qwe ... Can I use something to get the ...
6
votes
2answers
378 views

Bash prompt doesn't print until I interact with console again

I don't even know where to begin to diagnose this one. Usually, when a command finishes, the prompt prints itself for the next command. However, that is not happening. Hard to explain with words, I'll ...
1
vote
3answers
6k views

Sendmail not working as desired in bash script

This is the code I have in a bash script that runs as a cronjob. The cronjob run as root. /usr/sbin/sendmail myemail@email.com<<EOF subject:Backup Error! from:backup@server01 $error ...
13
votes
1answer
603 views

Opening a file from terminal only by typing its name

I know that xdg-open will open from terminal a file in the user's preferred application like this: xdg-open filename But I wonder how can I open a file from the current directory in its default ...
1
vote
3answers
631 views

Alias substitution for a string to use it in a terminal command

Is there a way to substitute aliases such that it is appended or prepended to an existing command in the shell? For example, defining the alias: alias execloc='/home/user/' Prepending this to a ...
0
votes
1answer
212 views

remapping shift key and bash script startup problem

My keyboard both shift key malfunctioned, my OS is Ubuntu 13.04. So I am using one of the control key as shift key. I did this using xkeycaps tool, and that's working fine and I need to do this ...
2
votes
3answers
90 views

Mysterious > prompt from missing right apostrophe

If I type for example grep 'needle > I get sent to a mysterious > prompt from which ctrl-C (or restarting the terminal) is seemingly the only escape. What is this prompt? Why doesn't it ...
2
votes
3answers
803 views

what this following bash script file do?

while browsing through hidden files of my home directory , I have found .bash_logout. I came through this content in the file if [ "$SHLVL" = 1 ]; then [ -x /usr/bin/clear_console ] && ...
5
votes
2answers
3k views

Configure bash to print exit status of every command entered

Every command that I type on bash returns with an exit code. I want: Whenever I type a command on bash prompt, I want it to exit and print exit status i.e. echo $?. e.g. if I run echo "hello"; on ...
0
votes
2answers
144 views

Why does this script work in the current directory but fail when placed in the path?

I wish to replace my failing memory with a very small shell script. #!/bin/sh if ! [ –a $1.sav ]; then mv $1 $1.sav cp $1.sav $1 fi nano $1 is intended to save the original version of a ...
1
vote
1answer
192 views

What are all the possible commands on Ubuntu Touch?

I'm trying to figure what commands are available in Ubuntu Touch before I think about installing it on my phone. I've figured out that apt-get is there. But what about dd, top and ssh etc., etc.? ...
2
votes
1answer
273 views

Can I set up a cron job on Ubuntu Phone

I've been looking around, and can't find if Ubuntu Touch can run cron. So my question is: Can it? Also does it have a standard set of bash utils installed?
2
votes
2answers
170 views

How to create scripts that create another scripts

I am writing an script that needs to generate another script that will be used to shutdown an appserver... This is how my code looks like: echo "STEP 8: CREATE STOP SCRIPT" stopScriptContent="echo ...
0
votes
1answer
362 views

Init.d script problem

The init.d script is installed properly and by me i wrote the script correctly. But i have a very strange situation. The script executes a multi-threaded program written in c++ by me. If i execute the ...
3
votes
2answers
1k views

find does not work with my variable

I'm trying to find the number of dirs and files in a given dir. I'm running my bash script like this: ARCHIVE=/path/to/archive ./myScript in my script I am doing this: #find the number of ...
2
votes
1answer
2k views

how to pass a{sv} arguments to gdbus?

i have problem to passing the arguments of the function in a dictionary format (string,variant); i try to run a screencast in gnome and to start the function i need to pass these asrguments: -method ...
0
votes
1answer
376 views

Cant create a file and write to it from a .sh script

I am trying to create a file and write to it using a .sh script but is not working(Nothing is being created, and I don't see any error). This is how that part of my script looks like: ...
4
votes
2answers
351 views

How can a function/script tell Xterm from Terminology?

I want to have a function in .bash_login that displays text if the current terminal is XTerm, but NOT Terminology. When I do echo $TERM in Terminology, it outputs xterm How can I tell them apart?
27
votes
4answers
74k views

How to view the `.bash_history` file via command line?

I want to view the contents of my .bash_history file but don't know how to get there via the command line.
0
votes
1answer
2k views

Can't redirect standard output

I'm following along with the examples in Chapter 6 Redirection of The Linux Command Line (2012). I am trying to redirect the standard output of an ls command to a text file. I keep receiving a ...
0
votes
1answer
499 views

How do I automatically change to a specific folder on login for an account with no home folder?

Typically I would create a user account and in the home folder, place the cd command in the ~/.bashrc file. For system users, however, with on home folders, the /etc/bash.bashrc file is used instead ...
1
vote
1answer
884 views

How to use sed with this complex expression of special chars and ips?

How to use sed to replace for example this expression: connection = sqllite///keystone@10.10.10.51 with this expression connection = mysql://keystoneUser:keystonePass@10.10.10.51/keystone
1
vote
2answers
484 views

Script won't run properly in crontab, no path or permission problems

I use the geany text editor, which has a command line option to list all open documents. The following command works fine when run from the command line: /usr/bin/geany --list-documents > ...
1
vote
1answer
159 views

I can't rename a file using the terminal if it came from a parameter

I am automating some deployment task with an .sh script but at some point I need to rename a file but it is not working. The file change can be different but the postfix is the same. Let's have a look ...
2
votes
5answers
5k views

How to remove special 'M-BM-' character with sed

I have file that was created by copying content from DOCX document with LibreOffice into text file. I have modified file with sed to remove additional spaces and other stuff but then I noticed space ...
3
votes
1answer
1k views

Why am I seeing only 8 colors in terminal (Xterm)?

I'm running Xubuntu 13.04 and I want to use Vim as my default editor for everything. I have downloaded many vim color schemas and tried them out, but all of them don't look like the official ...
1
vote
1answer
161 views

Running NYPL's Map-vectorizor in Ubuntu - GIMP scripting errors

I hope this is the right place to ask this question I recently endeavored to digitize a bunch of old maps and I aim to use NYPL's map-vectorizer tool that was written inside a Mac. The aforementioned ...
1
vote
2answers
180 views

How do I execute a program with default variables?

How can I execute a program (specifically a bash alias) with the default environment variables? Consider this example: export test="something I dont want to exist" alias _xterm='xterm -fn 7x13 -fa ...
3
votes
2answers
4k views

Open URL from Bash script

I have a text file Google.com Youtube.com Gmail.com Yahoo.com I am trying to open them with Lynx. Here is the thesis. I will store all of those links at a txt file, say links.txt and then I need ...
2
votes
2answers
8k views

How to change my shell to real bash?

By typing echo $0, I know I'm using tcsh in my Ubuntu 13.04 terminal. However no matter using chsh -s /bin/bash or just typing bash still can't make bash as my present shell. The interesting thing is ...
1
vote
1answer
2k views

Calling function in another bash script

Let's say; Script a.sh has function f1 defined. Script b.sh needs to call f1 to use. How do I do that? I searched online, it says I have to edit some PATH vairable, but does it mean global PATH or ...
3
votes
2answers
4k views

How to launch a terminal from script and another script to run in terminal

I run a script when I log in that basically looks like this: chromium-browser & xchat & cd ~/randomdir && gnome-terminal & qbittorrent & On the third line (cd ~/randomdir ...
0
votes
2answers
221 views

Some Bash questions for a newbie

I am studying Bash, but there are some things that are not explained in my book. First I'll post a script, and then I will ask questions going through scripts. Bash Script: $ cat sortmerg ...
0
votes
1answer
134 views

A bash script that opens several terminals from different direcotories and operates some funtions on those terminal

Maybe my question was partly answered here but I need full solution. What I want to do is this: gnome-terminal --tab -x "cd /ini/experiments/ gedit mytext.txt" --tab -e "cd /ini/myex/ipython" So I ...
3
votes
1answer
1k views

Can I implement tab autocomplete in a bash script?

I have a script that, when a user enters a file name in a directory, performs automatic tagging operations on that file (mp3 tagging). My problem: It gets really tedious typing in the exact file ...
4
votes
1answer
105 views

Bash, what is command, utility, builtin, how do I distinguish

I'm running Bash scripting, but sometimes I get confused which of these commands I use belong to who. Sometimes man xxx works, sometimes doesn't, so I use --help or info, mostly one of these works to ...
13
votes
3answers
2k views

“quote” command in the shell

What is the usage of the command quote? I haven't found any info about it, it isn't among the executable files in /bin folders, and it cannot be found among Bash built-ins. It seems that it only ...