Tagged Questions

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

learn more… | top users | synonyms (1)

0
votes
0answers
5 views

How to terminate server process?

i just created automation sending an email using a shell scrip, but it always running and send me an email every sec to my email. im using PID and that process name to terminate it, im writing ...
0
votes
0answers
17 views

UMS.sh (run as service) on Ubuntu 14.04 won't read configuration file

I'm trying to get my ubuntu 14.04 to run universal media server so I can stream movies to my ps3 (lowest firmware 4.55 unfortunately - unjailbreakable). After much research on the net I was able to ...
1
vote
1answer
11 views

How to make a application/script available from Bash? [duplicate]

If I want to launch a script (let's say in the home directory I have a file called hi.py) I need to specify the full path: python /home/user/hi.py. But when I want to use mkdir I can simply say: mkdir ...
1
vote
1answer
37 views

Shell script to move all images excluding ones with size in name using find?

I have a server backup of a WordPress site that has about 1000 images in the uploads directory. When an image was uploaded through WordPress it would create multiple sizes of the image such as: ...
0
votes
1answer
31 views

/etc/network/if-up.d script with password prompt

I want a script that logs me in when a specific interface uplink was established (university LAN). The thing is I don't want to hardcode my password into the script. Is there any way to prompt for a ...
-1
votes
0answers
11 views

Hadoop gives Error localhost: Error: JAVA_HOME is not set.?

I'm using Ubuntu. I have installed Java Hadoop configured it as single Node. i have also added environmental variable named HADOOP_HOME,JAVA_HOME in .bashrc file. When i was trying to run Hadoop using ...
0
votes
1answer
20 views

How to detect if an OpenVPN connection has disconnected?

I have a machine that is connected to a VPN through OpenVPN. Is there a way to detect if the connection has dropped and run a script in the event of the disconnect?
3
votes
2answers
63 views

Redirecting output to a variable?

I'm interesting in directing the output from two commands to a variable. I don't want the output to be displayed on the screen, but instead assigned to a variable within my script so that I can use ...
0
votes
2answers
23 views

Set custom added PATH vars to work in each Terminal session

I ran these 2 commands simply in the terminal: export PATH="$PATH:/home/milkncookiez/Developer/android-studio/bin" export PATH="$PATH:/home/milkncookiez/Developer/PhpStorm/bin" in the 2 bin folders ...
0
votes
1answer
46 views

shuffle filenames inside a folder and place changes in a text file [on hold]

I need to shuffle all the files placed inside a folder and keep track of all changes that have been made in a text file. The generated output will be same set of files with new names like ...
1
vote
3answers
72 views

copy n number of files from one folder to another folder

I have a folder of n number of files. I need to move n/2(or)n/3 files from that folder to any other folder. How to set the value of n so that it will move exact those number of files?
1
vote
1answer
24 views

Bash: what is the meaning of ${parameter##word}

I'm working on bash code and I found a function CheckOtherFiles that I guess is used to check if a file ($1) is more recent from file $WS_ROOT/$NomeVista/COMP/COMP_COMPILE. CheckOtherFiles is called ...
8
votes
2answers
659 views

Is there any default function/utility to prompt the user for yes/no in a Bash script?

Sometimes I need to ask the user for yes/no to confirm something. Usually I use something like this: # Yes/no dialog. The first argument is the message that the user will see. # If the user enters ...
7
votes
2answers
498 views

Why “which” returns none on some commands I can run?

I used which to tell the location of a runnable file. For example, which pwd returns /bin/pwd. However, I found which alias or which compgen etc returns nothing. What are commands like alias? Aren't ...
0
votes
4answers
31 views

scripting chroot, how to?

So I'm looking at: https://help.ubuntu.com/community/LiveCDCustomizationFromScratch and trying the following within a bash script: sudo chroot chroot mount none -t proc /proc mount none -t sysfs ...
0
votes
2answers
33 views

Media Scanner Script

I am a beginner with Bash scripting. I have recently been working on a script to harden Ubuntu computers for a school project. Everything is going well, except that the students are not allowed to ...
0
votes
2answers
38 views

Continous Loops in Bash

I'm interested in writing a program that will get the size of the mail spool file for the user. (The spool files found in /var/spool/mail/$USER on Linux). To do this, I would like to create a ...
27
votes
1answer
1k views

How can I make cowsay say something every time I close the terminal?

I want cowsay to print something like "have a nice day" when I close the terminal. I know I have to have some kind of script, but I'm not even sure how to write a script or how to use it once it's ...
2
votes
2answers
205 views

Run a standard command in bash script

I am writing a bash script to automate several actions: #!/bin/bash echo "Hello, World" NAME="${1}" PATH="${2}" echo $NAME echo $PATH eval "ls" I am going to call ls, ffmpeg and a lot of ...
0
votes
1answer
19 views

Trying to add timestamp to image but keep getting error unknown image property “%[exif:DateTimeOriginal]”

I want to put timestamps on all images in a directory based on the date created/modified. I've seen a bunch of methods like this and this, but they all use the code %[exif:DateTimeOriginal] which ...
3
votes
1answer
337 views

How do I delete all pop/rap music?

I have all the music stored in ~/Music and I want to delete all pop music (or it could be a different genre). I was thinking to look the song metadata to check and see if a song is pop, and then ...
-1
votes
1answer
63 views

Can't type letter 'm' in bash

My current BASH version is 4.2.45(1)-release. I can't type letter 'm' in terminal. Tried using various terminals. Even copy-paste is not working.(Plz Visit this page before u comment)
1
vote
1answer
15 views

Where does /etc/inputrc come from?

I'm just being curious about how or from what package the /etc/inputrc file is generated in an Ubuntu system. I've tried: $ apt-file search /etc/inputrc But it outputs nothing. No package assigned? ...
0
votes
1answer
13 views

unexpected EOF on the last and next to last line while creating alias

I am creating alias in .bash_aliases file in Ubuntu 14.04 with reference of this article I write these alias agi='sudo apt-get install' alias upd8='sudo apt-get update' alias perms='stat -c '%a - ...
0
votes
1answer
15 views

Mercurial no color in commands after doing su

First noticed in 12.04 still persists in 14.04 This happens when to change to a system user (www-data, postgres, etc) and not for a user which has a desktop profile setup. What I have tried: Copy ...
1
vote
2answers
48 views

How to run a shell script with a file argument located in the same directory at the script? [duplicate]

I would like to run a command with an argument placed in the same directory as the shell script, from a shell script. example: my_installer.sh: #!/bin/sh sudo dpkg -i --someflags=abcd blah.deb ...
2
votes
1answer
55 views

Rename all files in subdirecories

I am having a problem writing a script for mass renaming of files in subdirectories. I have a folder with multiple subfolders, and those subfolders have multiple files that I need to rename. This is ...
1
vote
1answer
61 views

UEFI machine doesn't boot Ubuntu through NVRAM bootcatalog. How to fix?

An answer posted here should: Avoid to require the user to download and install additional packages or PPAs. Be as quick and simple as possbile. (I tried boot-repair and it didn't ...
5
votes
3answers
623 views

What is the point of the bash Null-operator “:”, colon?

What is the point of the "null" operator in a BASH script? I understand that it is used as a placeholder following an if command when you have nothing to say, but need a command to allow the program ...
1
vote
2answers
127 views

How to enable tab autocomplete for scripts located in ~/bin?

If I put an executable in ~/bin I can just type the first few letters of the filename and then hit tab to let the shell finish the rest of the name. While this works with executable programs, it ...
0
votes
1answer
12 views

Smartctl script to write zeros

So i have an old hdd that was badsectors and i wrong the following script to write zeros in badsectors that smartctl finds. The question is will this help the read/write errors or it is futile? the ...
0
votes
1answer
22 views

Terminal error (some typo somewhere?) with .bashrc disables all aliases etc

I can't use any of my aliases or custom defined variables in bash. The error when I open the terminal is immediately: : command not found bash: /home/khaverim7/.bashrc: line 6: syntax error near ...
0
votes
1answer
34 views

What damage will an accidental move of /bin do?

Whilst testing a little bash script I've been writing, a little finger trouble led to a directory name variable not being passed in, resulting in a move command being applied to /* . /boot was moved ...
1
vote
1answer
42 views

Recover accidentally deleted function that is loaded in bash

I was editing my .bashrc file (actually a file sourced in there) and added a bunch of functions. I track my home directory in git, but I accidentally did a hard reset before even staging the changes. ...
0
votes
1answer
25 views

Sharing variables between shell scripts [duplicate]

I have a shell script (let's call it parent.sh) which calls another shell script (child.sh), passing it an argument. The child script does some work and sets a value in a variable called create_sql. ...
1
vote
2answers
45 views

How can I run a bash script without affecting the file system?

I am trying to create some soft of a sandbox for linux systems (ubuntu). My main goal is to find out which files are executed by a bash script of my choice, without actually letting it run them. I ...
2
votes
5answers
310 views

Concealing long paths in variables in Bash

I have to move files from one folder to another but they reside in totally different paths. The destination path is so long and complicated that I am not able to remember it. Is there any way to go ...
-2
votes
2answers
51 views

Shell Script to check for subdirectory [closed]

A)I used the following code to get the modified date of a file. But this is also selecting the subdirectories and thus returning an error. How van I fix this. for file in $1/*; do echo `stat ...
0
votes
1answer
34 views

Run script on shell login for all users

I have a script named "als" that parses the aliases in a user's .bashrc file that I'd like to run for any user logging in via SSH. This should display similar to a Message of the day (MOTD) banner. ...
0
votes
1answer
19 views

Bash error when installing cascade server

I downloaded the .bin package for cascade server 7.2.2 from their site. I am trying to install the 64bit linux package on a 64bit Ubuntu 14.04 Server VM. I am logged in as root. First I did: ...
1
vote
2answers
45 views

Shell script file (.sh) does not run, and throws an error

I am new to linux, and I have a shell script (.sh) file I on my Desktop that I want to run. These are the steps that I did: This is the content of the test.sh file on my Desktop: #!bin/bash ...
0
votes
1answer
18 views

show limited git diff status in ls, only in git directories

This might be an odd problem, but I would like to override the behavior of ls when in a git directory. I want to extract some diff statistics from the last commit, and append it to the bottom of the ...
0
votes
1answer
50 views

Start program after login in Ubuntu

I try to run Jira after Ubuntu start. In /etc/rc.local I wrote this: cd atlassian/jira/bin; ./start-jira.sh (all directories wrote properly) Where is my mistake? Full rc.local: gists
2
votes
1answer
95 views

Cant read variable from user input in bash

I try to run script of my friend and I get this error when try to input some variable: : bad variable nameead: reload : not foundsh: 10: bin/reload.sh: bin/reload.sh: 11: bin/reload.sh: Syntax ...
1
vote
1answer
27 views

bash ./eclipse permission denied

I just downloaded the adt bundle.As per the instructions on the android site , it just says that double click on the eclipse icon and the IDE should start right away. But when I do so it searches for ...
0
votes
1answer
30 views

Using Python Interactively as a CLI calculator

I'm running Ubuntu 14.10 & I'm totally new to Python. I'm aware that Python can be used as a CLI type calculator in interactive mode, a bit like the bc command in Bash. I have two questions: 1) ...
2
votes
2answers
39 views

awk command while ((getline < “gpsoutput.tr”) > 0 for constantly updating file contents

I am currently using a G-STAR IV globalsat GPS which gives me the following output (which is coming from the GPS every 1 second) and I save this output by redirecting to a file name "gpsoutput.tr". ...
0
votes
1answer
27 views

xdotool commands run one by one

I have this bash script: #!/bin/bash function foo() { terminator xdotool type 'myalias' xdotool key Return xdotool key ctrl+shift+t xdotool type 'cd ~/git/apps/myapp/client && ...
3
votes
1answer
68 views

Blank line in my bash.history?

I was taking a look at my .bash_history, and I found a blank line. I thought that I could have pressed "enter" while I was taking a look in the file. Is that normal? Or maybe I really pressed enter ...
-1
votes
1answer
42 views

Use find command but exclude certain directories [on hold]

I am trying to run the make command, but it says