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

learn more… | top users | synonyms (1)

1
vote
2answers
53 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
325 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
56 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
59 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
98 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
27 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
55 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
137 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
69 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
47 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
50 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
79 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
42 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
380 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
46 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
45 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
41 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
76 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
346 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
46 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
47 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
58 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
73 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
126 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
44 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
30 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
47 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
53 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 ...
1
vote
1answer
59 views

How to add header file by script? [duplicate]

I want to add a sentence to header of a file using bash script, I tried echo "#define Block $i">>mypro.cpp but it add '#define Block $i' to it's end. Thanks in advance
3
votes
2answers
71 views

How to print the first three digits after the decimal point of a floating number?

I am new to BASH and learnt that both printf and echo write to the standard output. But, I came through the following example which reads an expression from input and computes the result to accuracy ...
1
vote
4answers
126 views

How Can I Run an Shell Script With .desktop Config File?

I am trying to run a shell script with a .desktop file but it doesn't seem to work, producing an error of There was an error launching the application at each attempt. I have the sh and .desktop files ...
1
vote
1answer
103 views

Deleting all files with filenames matching a pattern and size below a certain limit

I need to delete all files with a .avi expansion and whose size is below 100MB. I have a large collection of video files and I need to delete the short ones to free up some space. How do I accomplish ...
1
vote
1answer
187 views

source not reading symlink correctly?

My .bashrc file is a symlink to ~/Scripts/rc/bashrc. This works well for me, and has been for years. However, as of today, this is what I am seeing: bash-4.3$ source .bashrc bash: source: .bashrc: ...
7
votes
4answers
1k views

How can I delete a file if it starts with <html> in bash?

I need a bash command to delete the entire file if the file itself begins with <html>. I'm not sure the best way to go about this... Context: I download a series of files via curl requests. ...
0
votes
1answer
57 views

How to automatically mute on headphones disconnect? Or how to tap bash script to system event listener?

My life would be easier if Ubuntu was muting the sound each time I disconnect the headphones, since every time surrounding is different (example day / night), but the same output volume. I may ...
1
vote
2answers
111 views

bash: using “cut -c” on the strings with spaces like “ ?.?”

i just want to get the third char from watingForHDD. Any idea how to do this? (my idea was to log some data about the used system capacity etc...) #!/bin/bash x="`top -d 1 -n 1`" echo "$x" ...
0
votes
2answers
103 views

How to write a script which automatically presses `Fn + F3` button on my keyboard

I am struggling with screen brightness reset issues . It resets to 100% on every reboot. I have tried searching for solutions but none of them worked[including xbacklight ]. Since I can change ...