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

learn more… | top users | synonyms (1)

0
votes
1answer
387 views

Mouse turns off after a few seconds (Ubuntu 13.10, Windows 8.1) [duplicate]

I tried lsusb and I can see my mouse in the list. I tried for foo in /sys/bus/usb/devices/*/power/level; > do echo on > $foo; > done But I got this reply bash: ...
0
votes
1answer
50 views

How to edit displayed bash name [duplicate]

I've done some googling, and looking around this stack overflow, but this one seems to elude me. How might I reduce/edit the displayed bash name on the terminal prompt? I.E. This: ...
1
vote
3answers
88 views

do,while in bash

I want to get RX and TX from each network adapter, so to get RX and TX from one network adapter, i used this commands : cat /proc/net/dev | grep 'wlan0' |awk '{if ($2) print $2}' | awk -v ...
0
votes
2answers
115 views

Create a file and write to it [closed]

Trying to create a file auto.home under /etc and write this to the file: 192.168.56.101:/NFS/home/& I am not doing it with commandline, but bash script. Tried this but didnt work: cat ...
0
votes
2answers
1k views

Starting bash from /usr/bin/env or /bin [duplicate]

Which would be advised as the first line in a bash script: #! /usr/bin/env bash or #! /bin/bash
2
votes
1answer
1k views

Sort files in directory by creation date(Birth)

In my Download folder I have a lot of files.I need first a way to arrange them by type second files with same type arrangement become by the type that i added(or can say downloaded or birth (if i am ...
3
votes
2answers
743 views

Add strings to a file with commands

I need to add: user_xattr,acl,barrier=1 to my /etc/fstab file. Is there a way to do this via the via shell script? I only want to edit the '/' mount. Here is what I have before I manually edit ...
-1
votes
1answer
61 views

bash excecuting each line of file and checking for sucess

I had a file with variable number of lines, and each line is a command, say, file1.txt: command1 command2 command3 My intention is to execute each line, and report "good" if the command is sucess. ...
8
votes
2answers
1k views

What's the use of complete command?

While running the complete command on my gnome-terminal, it shows some commands.What are they? And what is the use of complete command? $ complete complete -F _minimal complete -F _filedir_xspec ...
3
votes
4answers
106 views

Calculating the number of lines in a file?

How would I calculate and display the number of lines and words that are contained in a .sh file?
0
votes
3answers
69 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
548 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
2k 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 ...
1
vote
3answers
243 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?
7
votes
2answers
886 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
165 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 ...
5
votes
1answer
889 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
288 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. ...
7
votes
3answers
3k 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 ...
3
votes
1answer
916 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 ...
18
votes
2answers
5k 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
619 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 ...
3
votes
3answers
2k 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 ...
3
votes
3answers
1k 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
81 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
273 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
107 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
482 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
151 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
622 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 ...
2
votes
2answers
19k views

linux bash script to create folder and move files [duplicate]

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
673 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
81 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
2k 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
376 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
215 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
301 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
923 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
2k 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
3k 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 ...
1
vote
1answer
934 views

Using for loop to create a flexible radio list in a dialog box from a shell script

I want to create a little Program using Dialog to play logfiles created with Script. The problem is that I can't get a dynamic radio list that automatically adds a row if a new logfile is created. So ...
12
votes
3answers
2k 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, ...
2
votes
1answer
1k 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
716 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
779 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
140 views

Automatically start Bash script when opening a graphical program

I want to start a shell script automatically when I'm starting, e.g., LibreOffice. The problem is that I don't know how. Where would I build the trigger to start the script in. Is there a ...
8
votes
2answers
507 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 ...
28
votes
1answer
21k 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
477 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 ...