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

learn more… | top users | synonyms (1)

0
votes
1answer
769 views

Who | awk Bash script

I am receiving the following error when attempting to run my script: ./watchuser: line 12: syntax error near unexpected token `echo' ./watchuser: line 12: `echo ("$User online since:" who| awk ' { ...
0
votes
1answer
78 views

Program interface is ugly when started by script

I am starting Qt-Linguist in a bash script via sudo linguist-qt4 $PathToParentDir/translate_$lang.ts I could also use gksu instead of sudo but this would add more dependencies since most people ...
2
votes
1answer
111 views

How to copy files to desktop for every language?

My bash script should copy files from /opt/test/file.txt to the user's Desktop. The source path is always the same, but how do I copy to desktop? The desktop has a different name in every language... ...
1
vote
1answer
658 views

Get system locale language code in bash for a dynamic path

Here is my bash-file: #!/bin/bash PathToParentDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" sudo linguist-qt4 $PathToParentDir/translate_de.ts What I need is that my bash script ...
0
votes
1answer
5k views

Setting system wide proxy through bash script (Temporarily)

I'm trying to temporarily set the system wide proxy option which is available as GUI in the Network Settings through bash script. I only want the proxy to be applicable while the script is running and ...
0
votes
2answers
758 views

Running a .sh file without root

I've recently downloaded a game (Mark of the Ninja from Humble Bundle 9 to be exact) to play on Ubuntu. From what I can tell after extracting the game, it is stand-alone and doesn't require ...
2
votes
1answer
3k views

Find USB device's directory /sys/bus/usb/devices/ using idVendor/idProduct

I'm trying to make a script that takes the product and vendor id printed by using lsusb, then checking against this ID to find the USB device's directory in /sys/bus/usb/devices. I initially thought ...
0
votes
1answer
305 views

Capturing text output to a log, while printing REALTIME to terminal

My output prints approximately 1 line per second to the terminal, maybe 100-200 lines in total. I've tried to capture the output using tee, but it prints all the lines at the end of the process, not ...
0
votes
2answers
1k views

MOTD - show memory usage

I'm a n00b when it comes to bash scripting, so I was hoping someone could help me out. I have a server running 11.04, and my message of the day includes how much memory is currently used: System ...
4
votes
2answers
378 views

How do I detect if I'm in a 'full screen' bash shell or GUI terminal window?

I have some code in my .bashrc that sets the terminal window title using the currently running command and it works great in Unity, where the terminal is in a window. However, when I'm logging in ...
-1
votes
1answer
329 views

How to install class bench using make all and bashrc [duplicate]

Class bench is program for Linux,Classbench duty is create packets and generate some rules which they call them filter set.In class bench there is three folder: trace_generator db_generator ...
6
votes
1answer
24k views

The fastest way to create a file from a terminal

What is the simplest way to create a file using a command-line? Usually I use: touch filename But is this the simplest/fastest way?
0
votes
2answers
3k views

sudo bash can't execute script

I try to run a shell script file but failed so far on Ubuntu. In my terminal: ~/Desktop/FTL/data$ ls amd64 exe_icon.bmp FTL licenses resources x86 ~/Desktop/FTL/data$ sudo bash ./FTL.sh [sudo] ...
2
votes
1answer
314 views

Nonblocking bash commands?

So I just created the .bash_aliases and wrote the following: callNotepad(){ wine C:\\Program\ Files\\Notepad++\\notepad++.exe $1 } alias notepad++=callNotepad Now whether notepad++ is already ...
10
votes
1answer
73k views

configure: error: C compiler cannot create executables

I was trying to install rvm using \curl -L https://get.rvm.io | bash -s stable --ruby --autolibs=enable --auto-dotfiles. It worked fine until I got a configure error: Error running './configure ...
0
votes
6answers
474 views

How to move between 2 very different directories in the terminal?

When I move files with a GUI file manager, I navigate to the source and destination directory in 2 different windows, and then drag and drop. Is there a way to do this in BASH (move a file to a ...
0
votes
1answer
1k views

System info - bash script

I am attempting to pull RX packets, CPU vendor and model along with CPU MHz. Here is my script: #!/bin/bash #systemstat case $1="-r" COUNT='ifconfig eth0 | grep 'RX packets:' | cut -d: -f2 | awk ...
3
votes
1answer
5k views

What does set -e do?

I have a script that I found and I trying to get it to run, it just downloads and install Apache runtime libraries. The first line is set -e and it is causing an error; what does set -e do?
0
votes
1answer
617 views

-bash: ./*: No such file or directory

I am attempting to write a BASH script to return the following information from CPUINFO using the following commands ./systemstat.sh -r to return the time along with total number of eth0 packets. ...
2
votes
3answers
198 views

Print multiple lines starting with “D” after multiple greps

I have two text files. Text-file-1 contains strings (one string per line); C 010 C 020 C 024 . . . Text-file-2 contains data in following format; C 005 Carbon D Carbon 1 D Carbon 2 D Carbon 3 D ...
0
votes
3answers
1k views

How to write a shscript to kill -9 a pid which is found via lsof -i

I'm using tomcat, and sometimes when I tell it to stop it doesn't properly kill the process. My way around this is too do: lsof -i tcp:8080 which outputs: COMMAND PID USER FD TYPE DEVICE ...
1
vote
1answer
187 views

Bring all open terminal windows forward using a script

I am trying to use a script suggested for an answer I asked earlier, however I am having trouble getting it to work. The script should bring all instances of a program (whose name is passed as an ...
2
votes
3answers
202 views

How to navigate through directories named with non-latin characters?

I just don't know if it's possible and how to cd for example in a dir that is not named with latin characters. Example: $ cd άλφα or $ cd альфа Update: In a terminal it is ok, but in a CLI ...
1
vote
2answers
554 views

Run program with group execution permission

I want to run program with execution permissions set to group. Unfortunately bash says "Permission denided". How can I run program as user different that root without giving ownership to this user? ...
2
votes
0answers
1k views

How can I create an X server that has a backing store?

So I am completely new to Ubuntu (I am running 12.04 on a Toshiba Satellite). I am trying to remotely access my work computer but I keep getting an error reading: "xevas: requires a X server that ...
4
votes
3answers
464 views

Add “not” to if statement in shell script

I have the following script that should exist if the user does not exist. #check if user currently exists on system if id $User > /dev/null 2>&1 then #user exists no need to exit ...
2
votes
2answers
3k views

Remove files in a directory based on partial name

I wanted to know what is the best way to remove any files no matter what their extension is based on a partial name. Example: 13-05-12_foo_something.jpg 13-06-01_something.png ...
11
votes
1answer
11k views

How to set environment variable before running script inside hooks/install?

I am create a simple charm to get my symfony2 webapp from git and deploy it on ec2. After getting the source from git, I want to run composer to resolve dependencies but I keep getting this error: ...
13
votes
3answers
21k views

How to delete selected results from bash history?

history command shows all the results but we can filter to get particular command using history | grep searchingCommand. It is really helpful. But the problem is it shows those commands also which ...
-1
votes
1answer
366 views

How to execute uWSGI with bash script and display warning if terminal window is closed?

I'm currently working on a web project on uWSGI, it's quite a chore to keep typing the same command in the terminal everytime I want to start up uWSGI, so I made an executable script that will ...
20
votes
2answers
50k views

How to read complete line in 'for' loop with spaces

I am trying to run a for loop for file and I want to display whole line. But instead its displaying last word only. I want the complete line. for j in `cat ./file_wget_med` do echo $j done result ...
0
votes
0answers
30 views

bash: ./metasploit-latest-linux-x64-installer.run: cannot execute binary file [duplicate]

I am installing tool for testing. but after download tool in folder, i try to install it by root@user:~ chmod +x metasploit-latest-linux-x64-installer.run root@user:~ ...
6
votes
8answers
22k views

Filenames with spaces breaking for loop, find command

I have a script which searches all files in multiple subfolders and archives to tar. My script is for FILE in `find . -type f -name '*.*'` do if [[ ! -f archive.tar ]]; then tar -cpf ...
0
votes
1answer
128 views

Linenumber of specific line in a file

I'm fairly new to bash programming, and I am trying to figure out a way of "grepping" a line with a certain pattern from a rather long logfile and proceeding from the line I just got with grep -w ...
0
votes
1answer
160 views

Shell not recognised by configuration scripts

When I try to compile different packages from source (e.g., ipsec-tools, openvpn, etc.) I obtain always the same error from the configuration script: $ ./configure ./configure: This script requires ...
2
votes
1answer
4k views

How to convert .pcapng files to .pcap/.tcpdump files?

I have a a few folders with 300 to 400 files each. The files are wireshark captures in .pcapng format. I would like to write a shell script that opens every file and saves it into a new folder using ...
4
votes
4answers
2k views

Select commands from bash history

Pressing the up button is tedious and I might miss the command I was looking for. So when typing history at the terminal gives me all the commands I have entered before, indexed to a number. Is there ...
3
votes
1answer
221 views

Shell script errors?

I am trying to create an interactive bash shell script to make it easier to install and configure a postfix mail server,But have them still enter the commands and then the shell run them, but I keep ...
12
votes
3answers
607 views

Can bash get out of sync with the filesystem?

I may not be phrasing my question correctly, but I'll do my best to explain the symptoms I'm experiencing. First, for context, I'm running an Ubuntu server (no GUI), version 12.04.3 LTS (according the ...
2
votes
1answer
623 views

How to keep the coloring in bash when using `sudo -i`?

I have changed PS1 variable in /etc/bash.bashrc to PS1="\n\[\033[0;37m\]\342\224\214\342\224\200\$(if [[ \$? == 0 ]]; then echo ...
1
vote
3answers
100 views

How can I sort images from terminal?

I have a lots of images with timestamp: cloudcam-20130825T115716Z.jpg In the same folder I would like to create a folder named after the date(20130825) and move all the images to this folder. Is ...
1
vote
3answers
2k views

How to check whether a file is in current directory or its subdirectories?

I use find to search for files in a directory or its subdirectories. find . -iname '*.csv', and it gives me the following output ./2012/t1.csv ./2012/t2.csv ./2013/t1.csv Now, I want to check in a ...
1
vote
2answers
152 views

What happens if I manually change the USER environment variable

After running env in the terminal to check if some of my other variables were persistant across settings I noticed the USER=xxx environment variable. I've had to reinstall Ubuntu before after fooling ...
-1
votes
1answer
2k views

Unable to locate package openfoam221

While I am executing command **VERS=$(lsb_release -cs) sudo sh -c "echo deb http://www.openfoam.org/download/ubuntu $VERS main > /etc/apt**/sources.list.d/openfoam.list"*][1]* I have a file ...
3
votes
1answer
1k views

Bash aliases - how do I run a file in a different folder without losing my current location?

I have a nice little bash alias in my .bashrc folder that allows me to start Tomcat running without having to cd into the folder first, e.g. alias startTomcat="cd ~/apache-tomcat-7.0.34/bin/ ...
0
votes
1answer
316 views

Bash history for root?

After installing 'ubuntu-desktop' on 12.04-LTS-server, the arrow keys work correctly for history navigation when the user is not root. However, for the root user, the arrow keys (for example, the ...
1
vote
1answer
7k views

Unexpected EOF in a bash script, why?

I can't normally run sh scripts. It's confusing. I set the permissions to 777 and +x so it should work with the 'sh' command, right... But it's working very strange. For example this scripts works ...
1
vote
3answers
3k views

How do you login into /bin/bash automatically?

Im on 12.04 LTS and am doing to Ruby on Rails development. When I start up my terminal and type in ruby -v it will list my Ruby as 1.8.7. When I type in /bin/bash --login then ruby -v will list it as ...
0
votes
1answer
2k views

Running a php script in apache webserver

I have created a php script and saved it as script.php, located in the /var/www directory. I also have index.html file which has a form which requires the user to enter a value and submit with the ...
0
votes
1answer
5k views

Inserting data into mysql table using a script

I am trying to load data into mysql database using the following script #!/bin/bash DB_USER='my_user'; DB_PASSWD='passwd'; DB_NAME='db_name'; TABLE='rass'; ...