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

learn more… | top users | synonyms (1)

1
vote
1answer
85 views

How can I get a file's UbuntuOne URL from the terminal?

How can I get the UbuntuOne URL from a file in a bash script? Here's what my script does so far: I run the script via Nautilus Actions, and it requires one parameter and an URL in the clipboard. The ...
1
vote
2answers
1k views

how to write a script that will execute xampp start and stop

I am trying to write a script that will enable xampp start and xampp stop with the same script without having to write in the terminal everytime. To start xampp, I write in console : sudo ...
1
vote
2answers
8k views

Create a Screen session with a bash script using contab

I want a .jar file to run every time the server boots up (we're using a VPS), and so I've edited crontab using crontab -e and then adding @reboot bash /home/bash/startserver.sh. But I haven't even ...
3
votes
2answers
3k views

Automatic say yes to make ext3 file system on disk

I am working on a script where I make a ext3 filesystem on a disk, the problem is that the script ask user to either say yes or no: root@ubuntu:/home/school# mkfs.ext3 /dev/sdc mke2fs 1.42 ...
1
vote
2answers
4k views

nvcc not found, but only when using sudo

I can't get ANYTHING working on linux. I'm trying to compile CudaMiner. sudo make: ypt-jane.o `test -f 'scrypt-jane.cpp' || echo './'`scrypt-jane.cpp mv -f .deps/cudaminer-scrypt-jane.Tpo ...
0
votes
1answer
69 views

script to backup file deleting file

Working on a bash script to take backup of a file, but the problem i get is that mv delete the file or rename it and create a file with the backupname. Script: test="/home/sysadmin/test/hei2.back" ...
1
vote
1answer
591 views

How to check if a restart of open-iscsi was ok

I am working on a bash script to connect a iscsi initiator to a target. After I have edited the iscsid.conf in the initiator I have to restart the open-iscsi with the command: service open-iscsi ...
2
votes
1answer
145 views

Can I open a new terminal with a new binary executing in it?

I tried to write a script that opens a new xterminal with some binary file(not command) running in it.The whole script looks like this: #!/bin/bash XTERM="/usr/bin/xterm -bg WHITE -e ...
16
votes
7answers
23k views

How can I run this sh script without typing the full path?

I'm still very new to Ubuntu. I'm using 12.04, and I'd like to know if there is a way to run this program/shell script without typing: /opt/idea/bin/idea.sh It's kinda tedious and I'm quite lazy. ...
2
votes
1answer
280 views

Heredoc Param evaluation in Bash

$times=$1 ssh -A vyas@subdom.dom.net <<- EOF for i in {1..$times} do echo 'Iteration' $i url='vyas@app' echo 'Connecting to' $url ...
6
votes
3answers
1k views

Install multiple ppas at once via terminal without using script

I want to add these four ppa's to my machine. sudo add-apt-repository ppa:noobslab/malys-themes sudo add-apt-repository ppa:alecive/antigone sudo add-apt-repository ppa:nitrux/nitrux-artwork sudo ...
4
votes
1answer
146 views

What is the meaning of “@INSTALLED_AT@” in a bash file

I have a bash scripts that contains the following lines: MY_HOME="@INSTALLED_AT@" LD_LIBRARY_PATH="@INSTALLED_AT@/lib" MY_BIN="@INSTALLED_AT@/bin" export MY_HOME export LD_LIBRARY_PATH exec ...
1
vote
1answer
48 views

Check if connection worked if not return error

Working on a bash script to connect a iscsi client to a server. How do I put this command: iscsiadm -m discovery -t st -p 10.0.0.30 in a if to check if the connection was established, if not it ...
0
votes
1answer
298 views

While loop in Shell

I want to make a while...loop statement in my Shell script like: while [ $line < $line_number ]; do echo $line done But there is an error. I think it is because I wrote it in bash code. But ...
0
votes
1answer
1k views

Execute script in sh mode instead of bash in Shell

I added my script called mylovelyscript.sh to /bin/ folder. My script contains code that echos text with different text colors. But when I run my script like $ mylovelyscript it executes in bash ...
1
vote
0answers
366 views

getting problem while executing ./bootstrap

bootstrap file content : !/usr/bin/env bash # The contents of this file are subject to the MonetDB Public License # Version 1.1 (the "License"); you may not use this file except in # compliance with ...
1
vote
0answers
284 views

Problem with characters encoding in bash in 12.04 new install?

I just installed Ubuntu 12.04.4 64 bits, all seemed to be ok, when I started to work on console I noticed: that I couldn't get some accented characters typed in to the console, for example, if I ...
0
votes
2answers
203 views

Nano save to stdout (or an inline editor for terminal)

Is there a way of saving nano to stdout? Or an inline editor for terminal? I mean, I would like to do things as for example, editing an interactive php script like (from terminal): $ php ...
0
votes
2answers
223 views

Start-up / Reboot scripts for different users

I'm still trying to learn a little more about bash scripting and start-up / reboot, I have read about crontab @reboot and also just looking at other options but I just wondered if someone could maybe ...
2
votes
1answer
3k views

omit filenames in grep

I am greping a string from multiple files, but the one undesired side effect, is the filename prefacing the output. How can I suppress the filename outputs using only grep? $ grep -i lp lpNet* ...
7
votes
1answer
122 views

How to lists different image-formats recursively in a tree?

How would I efficiently go about searching for .png | .svg | .xpm image-files in a complex and recursively structured hierarchy in one query, using terminal (and if possible | (pipe) tree in the same ...
1
vote
2answers
223 views

Adding hours to an arbitrary, unformatted date

I need to add 84 hours to a specific starting UTC date. The start UTC date is the current date but the starting hour is not. The code below works great until the end of the month when it can't convert ...
4
votes
5answers
6k views

Data extraction from a text file using bash

I am looking for a bash script. In a text file I have data like: +------+------ | Id | User | +------+------+ | 8192 | root | | 8194 | root | | 8202 | root | | 8245 | root | | 8434 | root | | ...
0
votes
4answers
857 views

No command is working, edited .bashrc file

I edited .bashrc file with PATH value, but when I open a new terminal after this, none of command is working. When i am opening a new terminal its giving : bash: export: `/usr/lib/java/jdk1.7.0_51': ...
1
vote
2answers
643 views

How to create a file or folder and the same time write it to the .sh file [closed]

How to create a file or folder and the same time write it to the .sh file? For example: word count for a file, write that info to a new file and save it in the .sh file at the same time. I tried: ...
3
votes
1answer
2k views

Console doesn't show pretty UTF-8 characters in Shell

I want to write some pretty, special characters taken from Web in my Shell Console with echo command. I want to write, for example, ▲ character, but it shows me ��� character. How can I solve the ...
4
votes
2answers
391 views

How to create a native application from a Shell Script?

I created a little application using Bash and Zenity that I wish to install on my system as a native application as well as a package that I can distribute. I have a .desktop file for my application, ...
3
votes
1answer
190 views

Call a command as if it were in called in another directory

I'm using a command line program whose documentation states: "You can run XXX on input located in another directory, but its output will always be put in the current working directory". I'd like ...
1
vote
1answer
798 views

setting PATH to /etc/profile or /etc/environment does not work with sudo

I want to launch Intellij IDEA IDE via sudo idea.sh. sudo because IDE needs to manupulate files from /etc/share. idea.sh is placed at /home/<username>/<path>/bin/idea.sh. I tried to add ...
1
vote
1answer
635 views

Script to rename files

I appreciate any help in advance. I have written a script to rename all .BMP files, and it seems to work, but I get the following error/message for each file: IM2019.BMP mv: cannot stat ...
0
votes
2answers
431 views

Capture console output into variable?

How could I capture the console output into a variable when running a utility so I can filter the text? Example: I am trying to capture the console output when I type bitcoind so that I can ...
0
votes
3answers
85 views

Shell asks me to install IDLE despite it being already installed

I executed this command to open a .py file in idle terminal : idle python_file.py Shell displayed the following message in response : The program 'idle' is currently not installed. You can ...
3
votes
3answers
502 views

How to check if alias is not replacing an actual command? [duplicate]

How can I know if an alias I make (in .bash_aliases) is not replacing an actual command by same name? I don't want to do such things by accident. (I looked in "Questions that may already have your ...
7
votes
2answers
1k views

Oneliner command to use kill given tcp port number instead of PID?

I often do e.g. sudo netstat -lpn |grep :8088 view the output tcp6 0 0 :::8088 :::* LISTEN 11189/java and then sudo kill -kill 11189 I'd ...
7
votes
2answers
999 views

Get bash history to remember only the commands run with space prefixed!

The commands executed in the terminal prefixed with blank space(s) are not recorded in the command history file. But is there a way to get the reverse i.e. the history should only record those which ...
7
votes
4answers
2k views

Use of default alias “alert”

The default alias Alert is for the command notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e ...
1
vote
1answer
27 views

Pipe or log APT, keeping Notes

I am making a script that installs a dynamic list of packages and I need to know if a package is 'redirected' to another packages such as rpm-dbg -> librpm-dbg. The way I was going to do that was as ...
3
votes
1answer
236 views

why doesn't kdialog send notification properly?

Here is the command: kdialog --passivepopup 'This is a notification' 55 This command sends a notification at the up-right corner of the screen, with a blue background and white text. I am ...
0
votes
1answer
207 views

How can force a bash script to execute in www, and not executing in filesystem/*?

I have some .sh bash scripts which creates some directories, downloads some sourcefiles via SVN and so on. The scripts works every well, but it annoys me that they are performing the action in ...
1
vote
1answer
105 views

Access terminal stdin when it's the source of the bash script itself

This is slightly messy to explain. I have a script that I want to deploy like this: curl -Ls example.com/myscript.sh | bash The trouble is the script reads from standard input like so: echo "You ...
0
votes
1answer
530 views

Why does my udev rule run several times?

I want to when I plug an usb device to my laptop, a script will be run just one time. So I use the udev rules system in UBUNTU 12.04. I wrote the below udev rule: ACTION=="add", SUBSYSTEMS=="usb", ...
1
vote
1answer
296 views

bash_profile colors

I have found these settings in many bash profile files and I don't know what they mean or do. Can anybody explain them? Thanks! # Terminal colors NM="\[\033[0;38m\]" #means no background and white ...
1
vote
1answer
268 views

Simple: check if volume group is found with a if

I am working on a script to check if volume group vg0 exist. The problem is that it return Found even when I delete the volume group. So very unsure what is wrong. #!/bin/bash if vgdisplay | grep ...
3
votes
4answers
368 views

grab volume name of volumes over 85%

I want from the output below grab all the volume names that have a capacity over 85%. I know that there isn't one in ths example but lets pretend there is. :) Filesystem total ...
3
votes
1answer
346 views

Writing a script to handle iscsi

I am currently writing a script that (atleast in theory) should install and add changes in config on iscsitarget, but I keep getting an error that I can't seem to figure out the origin of. The errors ...
0
votes
1answer
516 views

Bash script fault creating mdadm array

I am working on a script to create md1 array, first to check if the array exist if not it will create it. I get command as command mdadm not found and a few others. The script wont run. ...
1
vote
2answers
9k views

Why script with /bin/bash is working, with /bin/sh not?

My friend asked me why this two simple script are not working in both shells: Test File "abc.txt": aaa 111 bbb 111 ccc 111 ddd Script #1 (a): #!/bin/sh while read -r line ; do echo ...
0
votes
3answers
914 views

How to clear history on logout

I tried adding history -c to ~/.bash_logout but seems not working. Add: I'm having success by adding these lines into my ~/.bashrc (referred from here) unset HISTFILE export ...
1
vote
3answers
4k views

Command to run GUI Frontend for apt-get update

I want know, if there is any command to run apt-get update in GUI like in the picture following: All i want to do is to write a script which will update the software sources through this gui ...
10
votes
6answers
7k views

How to get the URL from a file using a shell script

I have a file which consists of a URL. I'm trying to get the URL from that file using a shell script. In the file, the URL is like this: ('URL', 'http://url.com'); I tried to use the following: ...