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

learn more… | top users | synonyms (1)

0
votes
2answers
35 views

Sorting the output of my directory

How can i create a new file called Option1.txt on my desktop. This file should contain the contents of my 'home' directory. And how would i make my output is: Sorted alphabetically by entry ...
0
votes
2answers
58 views

How do I fix 'jekyll: command not found' error permanently?

I've installed Ruby, RVM, and Jekyll following this tutorial and everything works fine after following those steps. My issue is that each time I open a new terminal window and want Jekyll to rebuild ...
4
votes
2answers
237 views

regex search works with `grep -E` but not with bash script?

I use the same regex with grep and it gives me a match but when doing it in a bash script, it return no match. Test String(part of the file testregex.txt): <a ...
0
votes
3answers
29 views

How to turn off restricted bash mode?

I accidentally turned on restricted bash mode. With bash -r command. Now I cannot cd. How to turn off bash restricted mode and get back to normal bash?
5
votes
2answers
370 views

Why does cd ~k (& tab) expands to cd ~kernoops when I already have a folder named “~kernel-ppa” in pwd?

I have a folder named ~kernel-ppa inside ~/Downloads. aditya@aditya-desktop:~$ cd Downloads/ aditya@aditya-desktop:~/Downloads$ ls ~kernel-ppa Now when I type cd ~k and press Tab for automatic ...
1
vote
3answers
32 views

Running game server from bash without waiting for input

I have a simple script which takes commands to start, stop, restart and return the status of a game server (SA:MP). The site provides the solution for using this command: ./samp03svr & Which ...
3
votes
1answer
46 views

How to automatically set terminal title to directory name without path

Currently, my bash terminal/tab title is set based on the directory I'm in. For example: bob@bobscomputer:~/i/had/some/great/pie/yesterday This isn't very useful if I have multiple tabs open ...
6
votes
2answers
126 views

Is there a way to shorten(not remove) the path displayed in the terminal by an alias

I want something like this: "vivek@grishma:~/xxx/yyy/zzz/src$" to be shown as "vivek@grishma:datasource$" where I would somehow have predefined "datasource" to be an alias for the long path above. ...
5
votes
3answers
315 views

Bash - executing commands in current shell

I was reading the O'Reilly book "Unix in a nutshell", and I saw there that commands can be grouped and executed in the current shell using the following format: { cmd1 ; cmd2 } I didn't understand ...
1
vote
1answer
45 views

How to extract/inject ID3 tags via bash?

I have a huge collection of MP3 files that have ID3 metadata. Is it possible to extract existing tags and images to plain text (e.g. JSON, XML)? Can I inject from plain text to MP3 file? How can I do ...
5
votes
0answers
81 views

Pressing enter produces ^M instead of a newline

For example, if I am tail -fing a file or reading user input, <Enter> will produce ^M in the terminal instead of ending the read or adding a newline to stdout. ^J works fine. I'm sshing into ...
1
vote
3answers
63 views

Run Bash Script in Client from Local Server?

I wrote a bash script for my use and it works. I want that script to be put in some server in my network and call that script in laptops / desktops in my network itself to execute. Any way I have made ...
1
vote
3answers
49 views

How to change the value of an argument in a script?

I tried the following small simple script: #!/bin/bash $1="bar" echo $1 But when I run ./script foo I get error and the value is not changed: /home/mika/script: line 2: foo=bar: command not found ...
0
votes
0answers
9 views

Openmpi mca parameters does not work

I am trying to setup some of the mca parameters for an mpi execution, The command I am trying to run is: mpirun --mca btl_base_verbose 30 --mca btl_tcp_if_include eth1 -nolocal -pernode -machinefile ...
-1
votes
0answers
17 views

Cannot run shell scripts from nautilus after update [duplicate]

I have freshly installed 14.04 beta today, with most of my local configs from 12.04 still existing in the home partition. Everything is fine, but one strange behaviour occurs: I cannot run shell ...
3
votes
3answers
273 views

Why let command doesn't work to add real numbers?

I need to add some real numbers in a script. I tried: let var=2.5+2.5 which gives me error - invalid arithmetic operator and then I tried: let var=2,5+2,5 which do not gives me error, but it ...
1
vote
1answer
65 views

Need script for ubuntu

Need a script to use in ubuntu I've bunch of .tgz folders in folder A, each tgz is having some files and tar files, inside the tar files there are folders and sub folders. Wants to move a particular ...
3
votes
1answer
138 views

Is execution stopped after an error?

When running a shell script, suppose an error occurs at one line. Are the other lines executed or does the execution of the script stop? I have a script I want to execute with many commands over the ...
1
vote
2answers
30 views

Grab a field without a fixed position via awk

I'm working on a script to wake different LCs on my LAN. MAC-Adresses are hard to memorize so I made myself a list that contains information about the respective PCs. Right now the list looks like: ...
0
votes
1answer
54 views

How to clear history from a script? [duplicate]

I am writing an script to dump my history log into another file "myhistory.log", and then clear that history. I have written the following set of commands: date >> myhistory.log history ...
1
vote
1answer
69 views

How can I alphabetize a multi line record from a text file?

Hi I'm working with bash script and I have example.txt below. How can I alphabetize the following 4 information about restaurants by the restaurant name and print it out? Note that the format when ...
1
vote
2answers
49 views

Creating nested menus in bash

I want to create more menus under option "a" when selected. If the user entered option "a" I want it to have a couple menus for you to select and for one of the options is to return to the "Main ...
0
votes
0answers
18 views

Automatic shut down and reboot at specific time [duplicate]

I have an assignment that requires me to write a script that shuts down a server at 11pm and reboots it at 6am daily. So far, I have only written a command to shut it down but I do not know how to ...
1
vote
2answers
157 views

linux bash script to create folder and move files

Hello I need to create folder based on a filename and in this folder create another one and then move file to this second folder example: cat.jpg create folder cat create folder picture move cat.jpg ...
2
votes
1answer
61 views

How can I delete a multi-line record from a text file?

For example test.txt contains: Hi Hello Hi world The code below removes a word from test.txt and creates a temp file test_removed.txt which contains the: #!/bin/bash echo -n Enter Input: read ...
2
votes
2answers
25 views

How can I write a script to install BleachBit only if the version installed is not a certain version?

I want to write a bash script to download and install BleachBit from a .deb file only if the version already installed is not 1.0. I am using Ubuntu 12.04 and Bleachbit is only version 0.9 in the ...
2
votes
2answers
67 views

Passing arguments to an interactive script which will run in background

I need to run a program in the background. I know that using '&' after a command runs the command in the background. In the following script: #!/bin/bash echo amt of time delay nsec read nano ...
1
vote
2answers
70 views

Selecting multiple files with in bash

I want to use Scriptreplay with multiple log/timing files located in the same Directory. The script I have right now looks like this: select timings in /mnt/home/$USER/shell_logs/*; do clear ...
-1
votes
1answer
41 views

Bash temporary log files [closed]

I am a newbie at shell programming. As I need to deliver a professional shell program, can someone help to clarify the following three topics: Standard way of creating temporary files and then ...
7
votes
1answer
77 views

Bash history keyboard shortcut for !*

In Bash, there are some handy operators to repeat parts of the last command: !^ expands to the first argument of the previous command, e.g., $ echo one "two three" one two three $ echo !^ echo one ...
3
votes
3answers
187 views

Backing up for syslog/dmesg/message to different folder

I have an assignment where I am required to back up the /var/log/dmesg, /var/log/syslog and /var/log/message to text files in a different folder such as the Desktop. It will also create a file called ...
1
vote
1answer
111 views

execute local bash script in remote machine using expect

I have local shell script. Now, I want to run this local script in remote machine. Of course I can use ssh, but as it(the local shell script) should be like an automated one, it shouldn't ask for ...
2
votes
3answers
235 views

Inserting a date and time of execution of a bash script into a file

I need to figure out how to automatically insert a date and time of execution of a certain bash script file, into a txt file. Lets just say I have a bash script named backup.sh, and each time ...
8
votes
2answers
336 views

How to display the name of file which I am currently editing with vim on terminal title?

I am editing multiple files located in the same folder, in multiple tabs, on a single terminal. pwd(directory in which I am currently working) is displayed on the top of the heading of the terminal, ...
1
vote
1answer
73 views

How to capture all visited URLs on the command line?

I like to get all URLs I visit in the browser live captured on the command-line for piping them to another program. How would I be able to do this? The format should be just one URL per line, nothing ...
3
votes
3answers
291 views

Bash Script Difficulty

I'm creating a bash script and I want to create a m e n u. I am a beginner and still a noob but appreciate all your help! When I run the code it displays the menu but the problem is when the user ...
1
vote
3answers
46 views

bash file comparison line by line with selected string

let us say i have two files a.txt, b.txt a.txt 87621 3bde NDF 87621 2dfg NDF 87621 cdef NDF 87621 abcd NDF b.txt 93291 abcd NDF 93291 2dfg NDF 93291 adbf NDF 93291 ...
2
votes
1answer
56 views

Automaticly starting Bash-script when opening graphical programm

I want to start a shell script automaticly when I'm starting e.g. libreOffice. The problem is, that I don't know, where I could build the trigger to start the script in. Is there a folder / file ... ...
7
votes
2answers
309 views

How can I toggle the touchpad depending on whether a mouse is connected?

I want to have my touchpad disabled automatically when an external mouse is connected and enabled when there is none. I have tried using touchpad-indicator but that fails in cases when the computer ...
10
votes
1answer
318 views

Scripts in /etc/profile.d Being Ignored?

I'm new to Ubuntu. I'm running 13.10 Desktop. I wanted to set some system wide aliases and a custom prompt for bash. I found this article: https://help.ubuntu.com/community/EnvironmentVariables ...
0
votes
1answer
25 views

Throwing error message when opening terminal

I'm new on Ubuntu and ROS. I installed two different distro. (groovy and hydro). When I open the terminal I take this error. bash: /opt/ros/groovy/setup.bash: No such file or directory I remove ...
1
vote
1answer
36 views

Bash history too short/keeps getting deleted (possibly doesn't survive reboots)

My bash history is working fine, except that it's too short. HISTSIZE and HISTFILESIZE are set to 16k, yet I've only ever seen about 1000 entries in my history file. Currently the oldest command in ...
1
vote
3answers
35 views

Terminating the Terminal process for a particular outcome

for example consider the following situation:: I need to print some numbers randomly one after the other with a time interval of 5 seconds between each, and I need to terminate the terminal process ...
0
votes
2answers
37 views

Image optimization with imageOptim using bash. How to get a summary

I am using imageOptim to optimize images on my server. It took me quite some time to learn rudimentary bash scripting to able to optimize all images in all my first level directories. My script looks ...
0
votes
1answer
37 views

How to check the current value of IFS?

I am currently running a shell script and I suspect the problem may be because I accidentally changed the default value of IFS which is a space to something else. I want to check the current value ...
0
votes
2answers
48 views

unable to type commands in terminal

I was install mpi and I have given the path for it in the .bashrc and I closed my terminal and after some time again I opened terminal it's showing following error in the very first line followed by ...
3
votes
2answers
56 views

How can I check for apt-get errors in a bash script?

I am writing a bash script to install software and update Ubuntu 12.04. I would like the script to be able to check for apt-get errors especially during apt-get update so that I can include corrective ...
4
votes
1answer
33 views

Can't login after adding script to /etc/profile.d

I have created a little script to add bookmarks in Nautilus to redirect users to network share. If I run the script manually, it works brillantly but as soon as I try to add it in /etc/profile.d, I ...
3
votes
1answer
224 views

Why are 'source' and '.' not always the same, when they're supposed to be identical?

I was under the impression that source was a synonym for . in bash. However, it seems that in the .profile file, source doesn't work. This youtube video demonstrates that when source is used in ...
0
votes
2answers
47 views

Help me fix my improper removal of files please

Upon opening terminal I get a notification: bash: /home/kylekroeck/Public/ccp4-6.4.0/bin/ccp4.setup-sh: No such file or directory My /.bashrc file: # ~/.bashrc: executed by bash(1) for non-login ...