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

learn more… | top users | synonyms (1)

4
votes
2answers
187 views

How do I iterate the arguments in a bash script?

Is there any method to iterate the passed arguments in a bash script? This answer from my question shows me how to use each argument, but I want to iterate them because the number of arguments is ...
0
votes
1answer
30 views

Count length of letter string

I have a file that look like that (DNA sequence in fasta format): >sequence_name1 ATCGTGATNNNNNNNNAGTCGATCGGATTCT >sequence_name2 NNNNATGTNNATGTCCNNNNNNN I want to count the length of gaps, ...
3
votes
1answer
144 views

How to check in a bash script if passed argument is file or directory?

I have to write a simple bash script in Ubuntu which would allow me to pass it some arguments and I want to check if these arguments which can contain spaces are files or directories. How can I do ...
0
votes
2answers
40 views

bash: ./WorldOfGoo.bin: permission denied

I tried to launch World of Goo from the terminal (./WorldOfGoo.bin), but somehow I couldn't launch it. It displays the following error: bash: ./WorldOfGoo.bin: Permission denied Can anyone help ...
1
vote
1answer
45 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
79 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
103 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 ...
2
votes
2answers
204 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 ...
0
votes
1answer
134 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
24 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
53 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 ...
1
vote
0answers
41 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 ...
2
votes
3answers
288 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. ...
0
votes
0answers
45 views

Terminal and Bash Meta/Alt key combinations

It seems to be impossible to use the Alt key as the Meta modifier for some Bash line navigation commands such as M-f and M-b. This is because Meta = Alt, and Alt-<letter> opens any menu that ...
2
votes
1answer
35 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 ...
5
votes
3answers
169 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
126 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
39 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
63 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
74 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
29 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
72 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
47 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
45 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
73 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
99 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) a tree in the ...
1
vote
2answers
30 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
4answers
410 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
0answers
28 views

Terminator - Bash character encoding - problem visualizing content of some files

I'm using Terminator to manage several bash shells. If I print the content of some files, some characters are bad displayed. Even if the character encoding is setted to UTF-8. Below there is the ...
-1
votes
2answers
30 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
115 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: ...
1
vote
1answer
164 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 ...
3
votes
2answers
131 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
44 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
102 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
70 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
50 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
37 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 ...
2
votes
2answers
85 views

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

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 ...
5
votes
1answer
100 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
192 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 ...
6
votes
3answers
181 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
19 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 ...
2
votes
1answer
45 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
59 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
31 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
34 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
61 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 ...
0
votes
0answers
26 views

A script which can be run from a flash drive and modify startup applications

So I have created a script I would like to run on computers at startup on the network I manage. Each is unique, so merging settings accross the network would be problematic. I could change each ...
0
votes
0answers
178 views

How to install windows 8/8.1 themes on ubuntu?

I found this link and this one that shows that win 8 theme could be implemented ! I could it even make it faster and 100% compatible to ambiance. My question is the following: We all know that ...