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

learn more… | top users | synonyms (1)

1
vote
3answers
17 views

How to run perform different actions from one script

How can I run different commands from one script? For example, if I want to run myscript new filename to create this file, and run myscript del filename to delete this file. At this moment I have a ...
-2
votes
0answers
21 views

Bash Script Automatic Port

How do, i make a script that every time i use the script it will set the port number in the config 1 Port higher, and and with a max Port how high it can go and and a port number where it needs to ...
1
vote
1answer
12 views

Losing environment info when using /usr/bin/sudo and /bin/bash

my question is why do I lose environment information like $PATH when running the following command: /usr/bin/sudo -H -u <user> /bin/bash -l -c '<command>' I'm trying to add the ...
0
votes
1answer
27 views

How to get a command to output the contents into Terminal, and my system clipboard [duplicate]

Let's say I have an alias on my system which I often use to tell me my system information, the alias is systeminfo, and it executes lsb_release -a which outputs: No LSB modules are available. ...
0
votes
2answers
30 views

Run python script when a file has been added to a folder?

Is it possible to run a Python script when a file has been added to a folder? In my scenario I have a folder that contains movies and the Python script gets the details (name, year, plot, rating, ...
0
votes
0answers
9 views

Unison and systemd timer problem

I've got a problem whereby if I run my bash script myself unison works as expected, when systemd runs it via a service on a timer then it does not work as expected. I'm logging the output of the ...
1
vote
2answers
21 views

roundign numbers perl

a vector I have looks like this v<-c(1,7,9,15,22,29,30,30,30,30,40,42,49,50,50,50,55) as I cant allow for numbers appearing more than a single time I would like to be the output like v ...
0
votes
1answer
38 views

Determine if current login is first for the month in Bash

This is a continuation of my post here Although A.B. provided me with the correct answer, which is by utilizing the output of last and checking if it's the current log in, it did not solve my ...
1
vote
2answers
32 views

Organising folders

I have several folders ("amazon", "niger", "rhine",...). Inside each of them I have several subfolders ("gfdl", "hadgem", "ipsl",...). Each subfolders is composed by 5 subfolders (e.g. in "amazon", ...
0
votes
3answers
43 views

Bash - create zip by finding files

I want to create bash script that find *.mp4 and zip it. I use this: #!/bin/sh zip -r $(find . -name '*.mp4').zip $(find "/home/ehsan/Desktop" -name '*.pdf') but not work and get this error: zip ...
2
votes
2answers
117 views

Saving generated passwords to a .txt file

random-string() { cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-8} | head -n 1 } Using this script to generate a list of several thousand random 8 digit alphanumeric passwords. Is there ...
2
votes
1answer
72 views

Bash script not running at startup from rc.local

I have written a simple bash script: #!/bin/bash echo "hi" > log exit 0 made it executable and its successfully running. I edited my rc.local to the following: #!/bin/sh -e # # rc.local # # ...
0
votes
0answers
9 views

ssh logout cause bash file problem

I have a .sh file which is called by a Node Web Server. In the .sh file I run some commands with my username [name], which is a superuser, without specifying the password. If I'm connected through ...
0
votes
2answers
34 views

End of file syntax error shell scripting

#!/bin/bash source conf.ini inotifywait -m -e create /$1path | while read file; do if ($(echo $word | head -c 1)"=$1 then echo $file cd $1inputpath ls -l |grep $file* zcat $file* > ...
0
votes
1answer
21 views

How to change cmdline variables on boot or first boot

Not sure if this is the correct place to ask this question. I am running Ubuntu 12.10 on an EMB-3500 board. Its is an I.MX6Q. So my U-Boot saves the evn variable for my video as a development ...
2
votes
1answer
21 views

Remove list of files from different subfolders

I have a folder (call "folder"), composed of different subfolders ("subfolder1", "subfolder2",...). I would like to remove a list of files in all the subfolder of "folder", while some files are ...
2
votes
1answer
33 views

using wget to download xml for conky script won't keep html tags

So I'm trying to setup a conkyrc for weather, using the following script: #!/bin/bash station="KRAP.xml" wdir='/tmp/weather' update_xml() { if [ ! -e "$station" ]; then ...
2
votes
1answer
30 views

Copy/move a list of files to a new directory

I have an huge amount of files (e.g. 110011basz.dat, 110012basz.dat, 110013basz.dat,...) inside a folder, call folder. On the other hand I have a list related to the files I need to move to another ...
0
votes
1answer
14 views

Run a .sh on startup

I am creating a restore backup. When it start up I want it to run a .sh file that run a application and then reboots with out asking for a passcode. I have already built the .sh file but I have try ...
2
votes
2answers
80 views

How to merge values from two different text files?

I have following data set in text files: file1.txt a1:b1 a2:b2 a3:b3 a4:b4 a5:b5 file2.txt b2:c1 b4:c2 b5:c3 How to merge these values to make output file like this: output.txt a2:c1 a4:c2 ...
8
votes
2answers
558 views

Is there an easy way to log all activity that a shell script does?

Is there an easy way to log all activity that occurs from a shell script to a file? I have a script. It outputs things like echo "instructions", as well as other program output. I know the commands: ...
2
votes
3answers
53 views

Get variable from Zenity list generated from .csv file

I'm trying to get the value from zenity list. But it doesn't work. Some help would be nice :) If I remove the ans=$ I get the value from zenity in terminal like this: 10.33.54.13|10.33.54.13 But ...
1
vote
0answers
27 views

gnome-terminal / mate-terminal don't save history on ~./bash_history

Two days ago I was using my computer as usual, when I noticed that the commands I used in mate-terminal were not saved in the history. I tried installing gnome-terminal. But it does the same. I was ...
1
vote
1answer
21 views

What is the difference between 'exec ssh localhost' and 'ssh localhost'?

I read man exec output, but did not understand the difference between these two commands: exec ssh localhost and ssh localhost. I tested both commands and did not found any difference. Is there any ...
2
votes
1answer
23 views

phone book script

Good day I am a newbie in Linux scripting, and I am now exploring LINUX then suddenly I was motivated to create a program and I want to create a phone book program I am now done creating the menu that ...
0
votes
0answers
26 views

cannot execute binary file: Exec format error [duplicate]

i´m new in ubuntu and i´m trying to install a program created by one of my professors, but when i try to start it, the terminal send me the message: bash: ../bin/cidre.exe: cannot execute binary ...
2
votes
1answer
72 views

Store grive command output to variable in bash script

I am trying to create a script that syncs my computer with google drive using the grive tool. I would like to store the output of the grive command to a bash variable, but I can't seem to get it to ...
1
vote
2answers
614 views

Bash “unexpected end of file” on line 11, there is no line 11

I'm trying a new conky theme on my Lubuntu system, and for running it I need to start a bash script: #!/bin/bash #sleep 18&& conky -c /home/mathijs/conky/conky1&& sleep 1&& ...
0
votes
2answers
34 views

pipe whole script to file and terminal

i want a 1liner to pipe to file AND terminal at the same time(write 1 command, then all other commands are shown like normal in terminal, but output, preferably but not required : command name, to be ...
0
votes
1answer
41 views

I accidently ran 'sudo chmod -R 775 /' and it completely broke my OS/Shell [duplicate]

So I accidentally did sudo chmod -R 775 / when I meant to do sudo chmod -R 775 ./. I quickly realized and hit Ctrl^C, but not in time to save everything. I realize this is a really stupid mistake and ...
1
vote
1answer
29 views

Bash script exiting when repeated in double click execution

This is my code #!/bin/bash function boo { function goo { echo "Please enter name" read name; echo "Hello $name" } function xoo { echo "Please ...
4
votes
1answer
46 views

What does '*' mean in the output to 'history' command?

I was seeing my history when I found a line with a * whereas, in general, the history has an output without any * I noticed this for the first time. When does this * appear and why? EDIT: ...
4
votes
2answers
126 views

Terminal autocomplete functionality can only match from the beginning?

For example, if I type in "apt-"and press tab,I can find "apt-get" below.But if I type in "get", "apt-get" cannot appear. How can I do to match not only from the beginning?
2
votes
2answers
330 views

Uncompress file from URL to hard disk?

How to uncompress directly from terminal if I have the URL of the file? For example : unzip www.test.com/test.zip destination-folder-on-my-pc
1
vote
2answers
20 views

How to navigate to directory which file system object has just been moved to?

I often find when using mv somefile somepath I often need to go to the location which the file had just been moved to. basically mv somefile somepath && cd somepath is there a way to ...
0
votes
1answer
27 views

Running lubuntu 14.04, easiest, fool proof way, to create a desktop shortcut and to execute sh file from desktop?

It sounds easy, but hell, it is not. I want a desktop icon that executes: /home/<username>/dev/intellij/bin/idea.sh if I create a sh file on desktop, it opens with leafpad. If I create ln ...
2
votes
1answer
56 views

Who is telling me “You have mail”

On a server running Ubuntu 14.04 I see You have new mail in the motd every time I log in via SSH. Q: Who is telling me this? Mail does not find anything, and I do not expect any mails on this ...
1
vote
2answers
25 views

Is it possible to specify a different zshrc file on login over ssh?

I spend all day ssh'ing into servers for work and the remote user is one that is shared by myself and several colleagues so I can't just blindly customise the shell as not everyone will want my tweaks ...
2
votes
0answers
31 views

preseed file and installation script

I am using a preseed file to auto install ubuntu 12.04. I create a normal user account (able to use sudo), I skip the creation of a root account. At the end of the file I have put this (seen it from ...
1
vote
2answers
23 views

Accidentally changed shell in gnome-terminal, no longer opens

I wanted to make screenfetch start at terminal startup. But I realized that I changed the shell from bash to screenfetch and of course gnome terminal doesn't startup. I have installed MATE terminal ...
0
votes
1answer
38 views

How to run a web url script in a terminal

I am attempting to launch a script via my terminal. It runs fine in my browser but not in the terminal. Ive tried... sudo curl https://www.example.com/myscript?info=1 sudo wget -q -O- ...
0
votes
1answer
18 views

read numbers with e in awk

Hello a file I am working with looks: header // SeqT: {"POS-s":174.683, "time":0.0130084} SeqT: {"POS-s":431.49, "time":0.0221447} ...
2
votes
3answers
106 views

Bash for loop - how can I include blank newlines? (IFS) [closed]

Please note this is pseudocode, and I am not trying to count lines this way, this question is to figure out how to include completely blank newlines in a for loop. cat file word word Since ...
1
vote
3answers
59 views

bash: /home/rathin/.profile:: No such file or directory while trying to reload it via “source ~/.profile” after editing it through “vi ~/.profile”

After I edited my ~/.profile via vi command, couldn't get out of it successfully. So I closed the terminal and when I tried it again after reopening terminal, it showed duplicate file named ...
5
votes
2answers
47 views

How to get [TAB] to work with arguments of aliases to autocomplete as can be done with the actual command

I have many aliases that I created in my .bash_aliases file, and they are very useful, so if I want all info on a package I do something like: allinfo software-center And that does the equivalent ...
0
votes
3answers
42 views

Why does asterisk produce unexpected results?

I'm new to bash. From the Finding Files documentation: You want to find every file in ~/mydir and all its subdirectories, recursively, with a file extension of .htm (or .HTM or .Htm...) and delete ...
0
votes
1answer
14 views

ROS installation:Environment setup:No such a file or directory

according to wiki tutorial of ROS installation. All of the previous steps are ok for me, but when I try to do the part of environment setup. When I type: echo "source /opt/ros/jade/setup.bash" ...
1
vote
2answers
53 views

In Bash or ZSH, is there an opposite to the `clear` command?

Typing clear into a shell creates a bunch of new lines until the output history above is all but hidden. Is there a command or method that does the opposite of clear? That essentially moves your ...
0
votes
2answers
27 views

history erase shell script not working

I am creating shelll script that is erase history of commands in the terminal. But the script is not erase the history of commands in the terminal. I follow below procedure 1. My script contains ...
0
votes
1answer
34 views

Running Bash script at login

This question has been asked numerous times but for some reason, none of the solutions proposed worked for me. I just want to run a simple script after the user has logged in. Here are my attempts: ...