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

learn more… | top users | synonyms (1)

2
votes
1answer
244 views

How to remove element from gsettings array in script?

Array in dbus/gsettings has a format [element1, element2, element3, ...]. Gsettings' interface allows only replacing existing array with another, so for instance, adding another item element can be ...
0
votes
1answer
1k views

node.js app runs from command line but gives errors when run from cron job on reboot on ubuntu 14.04 LTS

When starting my app manually using forever, it works fine. It runs on localhost:8080 and nginx does the routing. When using a cronjob my starter.sh script runs but in the forever log I get an error. ...
1
vote
2answers
57 views

Why is program not executed even though it is in my path?

I am trying to run a program in /usr/local/bin/ called runserver. /usr/local/bin is in $PATH... echo $PATH ...
1
vote
1answer
86 views

Disabling the grub recovery mode programatically

I need to be able to update the grub config to remove the recovery mode boot option, programmatically. I got the initial info for how to do this (manually) from this question/answer: How to disable ...
3
votes
1answer
463 views

How do I pass complicated shell commands over SSH to be executed remotely? Mine throw syntax errors or get interpreted locally!

I have a command like this which tells me if a system has a disk that's getting full (>=70% full): if [[ -n df -PTh|column -t|awk '{print $6 $7}'|awk -F"%" '{printf "%-9s %-5s\n",$1,$2}'|grep -v -e ...
1
vote
1answer
338 views

shell - cut: you must specify a list of bytes, characters, or fields

I am trying to get the output of the command line arguments in reverse order. But I am getting a error while doing so. This is the code: #!/bin/bash str=$@ len=$# space=" " echo "No. of arguments = ...
2
votes
2answers
241 views

How to use sed to substitute current date?

How do I use sed to substitute date by a word. I tried doing this: tmp=`date +%d` echo $tmp if [ $tmp -lt 10 ] then pat="d" echo $pat else pat="dd" echo $pat fi cal | ...
1
vote
2answers
134 views

Weird output by declare and array

I am trying to output the values of array element but I am getting weird output. Please have a look at it and help me solve it. Thank you. n=2 declare -a myarray[$n] myarray[0]=hey myarray[1]=hello ...
1
vote
3answers
91 views

Value of if command outcomes

I'm pretty new to Ubuntu linux, let's say all of linux because I installed it a few days ago. I'm sorry for my mistakes in my use of English, because I live in the Netherlands. Well I tried to do ...
2
votes
2answers
620 views

bash - wrong answer by word count command

I am trying to get the word count of a string using the wc command. But it gives me a different answer. It increases the number of words by 1. This is the code: echo Enter a string: read str ...
6
votes
3answers
998 views

How to open several image files from command line, consecutively, for editing?

Lets say I have three image files to edit. Consider all the files are in ~/Pictures. Let name of the first file be 1.svg, name of the second file be 2.svg and name of the third file be 3.svg .I have ...
1
vote
0answers
102 views

No Tab Bash Auto-Complete for apt in Ubuntu 14.04 [duplicate]

Now Ubuntu 14.04 is released and I upgraded my system a few days ago. One major change was the introduction of a new version of apt. Fortunately, it is possible to do the most common task by just ...
0
votes
1answer
217 views

Error executing Xilinx ISE Design Suite .bin file(java xsetup)

I'm, trying to build Xilinx_Vivado_SDK_2014.1_0405_1_Lin64.bin on ubuntu-12.04 Got the below error: ..... ...
0
votes
0answers
128 views

Bash Script for Git Checkout

How do we create a bash script to do a git checkout on a couple of previous commits? cd /Users/testuser/testproject for i in `cat /Users/testuser/Desktop/commits.txt` do git checkout $i I have this ...
4
votes
1answer
223 views

How can you mirror an autocomplete function in your own aliases (in 14.04)

I have a bunch of aliases that I've used on my 12.04 machine. example: alias pssh="tsocks ssh" alias pscp="tsocks scp" alias prdp="tsocks xfreerdp ..........SOMETHING ...." These aliases are ...
1
vote
1answer
57 views

What does bash do with line 11 here?

The nature of the question here is broad enough truly to include Ubuntu. I was just picking around forums analyzing this and that and line 11 puzzled me. What I would like to know is, what exactly is ...
0
votes
2answers
142 views

Launcher for programs which need multiple commands to run

I already installed a program called CadFeko, and I can run it from terminal. To run the program, first I have to run this command . /opt/feko/6.3/bin/initfeko Then I can call the program by ...
0
votes
3answers
197 views

Why is /bin/true such a large file? How would I find the source code?

I just found out about /bin/true yesterday. I'm not a bash power user by any means, but I decided to check it out. I was surprised to find that it is a 22K file (Ubuntu 12.04), and not one of the ...
0
votes
1answer
31 views

VIM stopped accepting a keyboard command

For some reason as of 3 days ago my VIM stopped accepting Ctrl-x from me. I have this combo mapped to Copy to X clipboard. It worked perfectly before 3 days ago. I have not changed my .vimrc file at ...
2
votes
3answers
480 views

Startup script Problem

I am new to Ubuntu.I want to run this script every time my system reboots.Is there a way to do that?Thanks in advance for help. # !/bin/bash #fix resolution problem xrandr --newmode "1440x900_60.00" ...
12
votes
5answers
934 views

Using cd command to navigate directories in Ubuntu which have special characters [duplicate]

When I want to navigate into directories having special characters in their names I get an error message. For example: aman@desktop:~/Aman$ cd !)e$!gn&(reate bash: !: event not found ...
1
vote
2answers
279 views

Attempting to setup Ubuntu 12.04 SSH Server: -bash: /etc/hostname: Permission denied

Attempting to setup an SSH-server running Ubuntu 12.04. Went to "HowToForge" to scout for potentially advanced or knowledgeable advice upon how to accomplish this, then I ended up running into a ...
3
votes
1answer
122 views

Remove lines of code from multiple files

I'm running a Web Server in a Virtual Box for testing some projects. And I noticed that some of the html files have this unwanted lines. I want these lines of code from multiple html/htm files ...
2
votes
1answer
28 views

Ctrl+a doesn't return all the way back in terminal

I recently updated my prompt to look something like [user@User] ~/wroking/directory (git-branch) ↳ using the following code in my .bashrc source ~/.local/bin/git-prompt.sh ...
0
votes
1answer
58 views

shell script to function on subfolders

I want to write a simple shell script that will go into all the sub-folders in a directory, and organise the files in the sub-folders into new directories. Basically in terminal it would look like: ...
3
votes
1answer
108 views

Bash script callable from home but not scripts directory

I'm having a very weird error when trying to make a script callable. I have a scripts directory in /srv/projectname/scripts where I store you know scripts to be called as cron jobs for different ...
4
votes
3answers
217 views

How to check the number of fields given to the `read` command?

I have a quick question relating to $# in the shell scripts. So, I can use $# at the command line to check the number of a shell script arguments given by the user. Example: # ./shellScript varONE ...
3
votes
4answers
367 views

Add to path only sh file not a dir

I have a bin folder with a bunch of sh files. For example "server-run.sh", "server-stop.sh", "server-do-something.sh". And I want to run file "server-stop.sh" from anywhere. I could add this bin ...
1
vote
2answers
4k views

Shell script issue: cron job script to Restart MySQL server when it stops accidentally

I have this script, I am using it to setup CRON job to execute this script, so it can check if MySQL service is running; if not then it restart the MySQL service: #!/bin/bash service mysql status| ...
-1
votes
1answer
147 views

Bad substitution error in appending a variable to a filename (renaming file)

I tried to append a variable value to a filename and get the file name as: Page_variablevalue It gives bad substitution error when at line: mv "$page.txt" "page_${variablevalue}.txt" Please ...
3
votes
1answer
113 views

Change the user in bin/bash

I want a script X.sh to switch users and perform an action, but so far I have this: #!/bin/sh sudo su partner -s /bin/bash supervisord -c ~/supervisord.conf exit I want that the user partner ...
0
votes
1answer
90 views

Array Splitting in bash [closed]

This following piece of code for constructing a sub array gives the output - sdf,sdf,sdf,sdf sdf,sdf,sdf,sdf But the expected output should be sdf,sdf,sdf,sdf sdf,sdf What is wrong with the ...
1
vote
1answer
495 views

How to edit /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts and similar files and why they can (not) be edited

I a trying to edit the following file (ls -alstr output): 0 -rw-r--r-- 1 root root 0 Apr 15 17:07 /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts Unfortunately, if I try to edit it with vim or simply ...
1
vote
2answers
2k views

Automating apt-get install with --assume-yes

I am trying to write a bash script to install a list of software. I am using --assume-yes to get pass the prompts This following line somehow doesn't work sudo apt-get install ...
-2
votes
1answer
33 views

what is wrong with this piece of code? [closed]

The following piece of code where I want to check if an array is empty gives the error - re.sh: line 3: [0: command not found. The error is at the if statement. What is wrong with it? #!/bin/bash ...
0
votes
0answers
22 views

Startup script xrandr missing LSB tags and overrides please help

hello i have a simple script that looks like this xrandr -s 1680x1050 When i run it standalone it works! when i put the script into /etc/init.d/xrandr.sh I get the error "missing LSB tags and ...
1
vote
1answer
213 views

Bash script for execute one command for many files

I just tried to clear my holiday video stuff and found program for stibilizng vision. There are a lot of files so I made script to stabilize all. Firstly I need to run command: transcode -J ...
2
votes
1answer
328 views

Can't find binary file in path

folks. I've extracted a tar file with a few binaries into /usr/local/arm/bin and setup my path to include this folder. When I try to run which: $ which arm-elf-gcc /usr/local/arm/bin/arm-elf-gcc ...
6
votes
2answers
296 views

How to tell which parameter is being supplied to a command with a redirectioin operator?

This works: $ echo "notify-send HELLO" | at now This doesn't: $ at now < echo "notify-send HELLO" It says 'file or directory not found". I understand there's a -f option to this ...
4
votes
2answers
1k views

How to automatically launch bash shell when opening terminal or in console mode?

I create a normal user account in ubuntu using "useradd" command, but the problem is that I have to type "bash" to launch the bash shell for this user account in both the console mode (in a tty, ...
7
votes
3answers
2k views

Where is the bash history for the root user saved?

I'm not talking about .bash_history from my home directory. I usually prefer to use sudo -i or sudo su and then run commands as root user. Since, after these commands the history is not saved in the ...
0
votes
2answers
75 views

Why is this command starting endless terminals and how to make it work?

#!/bin/bash gnome-terminal --command='/home/user23/bin/n-youtube-dl "$1"' I want to pass the argument passed to this script to the other script started in the terminal. But this starts endless gnome ...
0
votes
1answer
94 views

How to alias one command to be resolved into another command?

AFAIK alias is usually used to make 'shortcut' for long command. But what to do if I want to alias one command to another? I need this because I replaced gnome-screensaver with xscreensaver, so the ...
1
vote
1answer
2k views

Pause execution and wait for user input

I have a script that I am making and I have an issue with it: I would like to pause execution and wait for user input. I thought that I had it with the read -p -n 1 $foo command but the system is ...
3
votes
3answers
273 views

Explain this shell redirection: uuencode host-file < host-file >encodedfile

How the below shell redirection works ? Appears to be complicated to understand the order of execution. Any easy explanation ? uuencode host-file < host-file >encodedfile
0
votes
0answers
40 views

Absolute basic MQ wanted - command line driven

I am looking to install a very basic command line accessible MQ product. It will be run on Ubuntu 12.04 lts, and should be able to support multiple readers. Any products I should be looking at?
-3
votes
1answer
55 views

Scripting downloaded programs

I downloaded a game for fun and I would like to add it as part of my code for my butler program. Say I have the game moon-buggy and I would have this code run it. if [ $word = "buggy" ] then ...
2
votes
1answer
250 views

How can one run a shell script just before the desktop session begins?

I want my system to run with 1366x768 resolution. Note that this resolution is not detected by the open source driver. So I created a bash script as follows :- xrandr --newmode "1368x768_60.00" ...
3
votes
1answer
543 views

Bash completion for the new apt command [duplicate]

I like the new apt command (which will be included in the upcoming trusty release) so much that I installed it on my precise system by compiling the 14.04 package from source. Unfortunately, bash ...
15
votes
2answers
2k views

Can I enable bash-completion for the new apt command?

The new apt command in 14.04 seems to be a really useful intersection of functionality between apt-get and apt-cache but the current version of bash-completion doesn't know about it... Which makes it ...