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

learn more… | top users | synonyms (1)

2
votes
1answer
69 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 ...
0
votes
2answers
161 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
652 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
144 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
20 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
48 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
36 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
44 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
42 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
54 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
327 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 ...
-1
votes
2answers
57 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 can I fix this? for file in $1/*; do echo `stat ...
0
votes
1answer
64 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
21 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
109 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
28 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
57 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
144 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
73 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
35 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
48 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
51 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
80 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 ...
0
votes
1answer
52 views

Use find command but exclude certain directories [closed]

I am trying to run the make command, but it says make: *** No targets specified and no makefile found. Stop. After doing some research, it seems that the error is because I need to run ./configure ...
0
votes
1answer
43 views

Need audio player for bash script

I'm working on a small audiovisual project, and I'm writing an auxiliary bash script to control some stuff. However, I need to play a generated audio file for a few seconds before stopping it, the ...
0
votes
0answers
21 views

Monitoring a screen session

I'm very new to Ubuntu and I haven't really found something that I'm looking for. Basicly I am searching for a bash script that will monitor a screen session based on it's name. As soon as the bash is ...
2
votes
4answers
385 views

Comparing two text files

I have 2 big csv files, file1.csv which looks like this 1,2,3,4 1,4,5,6 1,7,8,9 1,11,13,17 file2.csv which looks like this 1,2,3,4 1,7,8,9 2,4,9,10 13,14,17,18 These are just random numbers that ...
0
votes
1answer
51 views

Make all new .sh file executable

One of my script is making new .sh files in /tmp/ folder how can I setup that all new files in /tmp/ folder will get chmod -x automaticaly because my script is failing when trying to run scripts in ...
1
vote
0answers
46 views

$DISPLAY env var gets cleared at random times

Stock Ubuntu 14.04 Trusty. I seem to regularly experience the $DISPLAY environment variable getting cleared for some reason I don't understand. Basically everything will work just fine until it's ...
-1
votes
2answers
42 views

how can i use command history in a bash file

i try to use "history" command in a bash file .sh but it didnt work with me how can i use it the code of the bash file #!/bin/bash # Copy history to file history #cd ...
0
votes
1answer
79 views

Unable to change brightness using after root access

Case-1 Recently I read a question(Brightness is reset to Maximum on every Restart). Then I opened up my terminal and typed out following command- sudo echo 200 > ...
4
votes
2answers
353 views

How to rename file extension to lowercase?

I know this question has been asked (and answered) before, but it seems my situation is unique, because I cannot have any of the solution to work. Running, I need to rename all my photos from *.JPG ...
0
votes
0answers
86 views

How to use start_daemon to launch a script?

I find start_daemon function in /lib/lsb/init-functions(show below) start_daemon () { local force nice pidfile exec args OPTIND force="" nice=0 pidfile=/dev/null OPTIND=1 ...
1
vote
0answers
21 views

Change content of list in app indicator made using cappind

I made a simple indicator using cappind script which is based on zenity - Webupd8 article Capind page I want to change the text of the list according to some condition.. Like, if the contents are - ...
0
votes
1answer
47 views

Bash Files - /etc/profile vs ~/.bash_profile file [duplicate]

Does anyone know what the difference between the /etc/profile and the ~/.bash_profile file is? Which one is executed first?
0
votes
0answers
48 views

How do I fix this bash script to auto-fix locked eth cards?

One of our servers has an eth1 interface which seems to randomly lock up--but which works again with no issues if this command is issued in the console: ifdown eth1 ; ifup eth1 I wrote a simple ...
0
votes
0answers
28 views

Unable to profile django app

I am trying to profile my Django application. I installed the django-extensions which include a hotshot profiler. I am able to profile using the Django shell. But, I want to create a script for doing ...
0
votes
0answers
60 views

Mount and unmount network shares using bash with different credentials for each user on login/logout?

I've had a look through a couple of similar questions but I'm not satisfied that there is enough information for me to work this out on my own :( Ok, I have a NAS which has it's own users, and each ...
0
votes
1answer
36 views

invoke a script on fail of a bash script

I want to run a script that create and host a website with apache server. if anything went wrong I have to rollback all the changes I made, like delete the created folder etc. I know set -e exits ...
0
votes
1answer
78 views

How to make xrandr scrreen resolution permanent?

I create script file name it lightdmxrandr.sh. here is file content: xrandr --newmode "1024x768_60.00" 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync xrandr --addmode LDVS-0 ...
0
votes
1answer
131 views

How can I save lines from terminal to a text file?

I made a simple bash script that pack a file and then upload it, if everything is fine I am getting some http:// links to my stuff as output I want to know how can I copy those links automaticaly to a ...
1
vote
1answer
47 views

Printing footers using enscript

I have a working bash script which converts text files to postscript using enscript 1.6.5.90-2 on Kubuntu 14.04. It does several other things to make the output look better like setting margins, ...
1
vote
3answers
68 views

bash script to check if input has an @

Hi I am trying to write a bash script in which the input is checked to see if it contains an @ symbol, I'm am relatively new to bash so please forgive any/all errors! So far I have: var1="@" ...
1
vote
0answers
34 views

pdsh works well standalone, but doesn't work in script

I am trying to install hadoop via script on my small cluster [introduced in the book: Apache Hadoop Yarn]. I have set up ssh connect without password, and pdsh&pdcp are all fine if I use it alone. ...
1
vote
1answer
47 views

Strang echo behavior

To boil it down: The following command in bash echo $(ssh -t pi@doctor "sudo stat -c \"%U\" /var/www/candy/example/index.html")101 Gives the this result Connection to doctor closed. 101-data ...
-1
votes
3answers
63 views

Create a script that takes a word as an argument from the user

echo "Enter your string" read str; How can I put in a check to make sure the user passed in a word, displaying a usage statement if a word was not passed as an argument.
0
votes
2answers
48 views

if stament in shell script

How write in if [ -z $str1 && -z $str2 ], "&&" doesn't work, if write [ -z $str1 ] this is work. I want to once two string #!/bin/bash echo "Enter first string" read str1 echo ...
0
votes
1answer
19 views

Use gnome-terminal as the Fzf launcher in GVim

How can you use gnome-terminal as the launcher of fzf in GVim instead of the default xterm: https://github.com/junegunn/fzf let g:fzf_launcher = 'xterm -e bash -ic %s' I want to use gnome-terminal ...
0
votes
0answers
56 views

Script problem at boot ubuntu

I have an application in C++ which show a ipcamera video when I send it a value by ethernet. I want that the application start at boot in automatic way. This is my script: #!/bin/sh ...
0
votes
0answers
54 views

Scheduled Cron Back up from EC2 to S3

I have created a script for scheduling sql back ups and store in Amazon S3. Below is the script that I used for taking backups. DATABASES="testdb" testdb_USER=root testdb_PW=root ...