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

learn more… | top users | synonyms (1)

0
votes
1answer
6 views

Unable to start a cron task as root

I use a program to check raid status. The command is megaclisas-status. Here is the issue : Has user /usr/sbin/megaclisas-status return : This script requires Administrator privs => OK Has root ...
-1
votes
1answer
28 views

What's wrong with tee command?

I am running the following python script piped to tee command #!/usr/bin/python from sys import exit,exc_info from time import sleep try: print "hello" #raise KeyboardInterrupt ...
0
votes
1answer
27 views

Can't execute this file

I can't execute the skype file. I have the permissions I need. What's the meaning of filename* in the ll output?
0
votes
1answer
16 views

How to make shell script restart Java if any thread crashes?

I have a multi threaded Java program. Ideally it should run once and successfully terminate. Unfortunately, sometimes one of the threads crashes, such as by throwing DivisionByZeroException. Since ...
2
votes
2answers
132 views

Why do scripts ran via “sh *.sh” function differently than “./*.sh”? [duplicate]

I'm using Ubuntu 15.10. I have noticed a weird problem. When running a rsync command embedded in a shell script (as root) with --exclude={} options, rsync works and excludes paths as it's supposed ...
-1
votes
3answers
40 views

Extract info from file

Is there an efficient way to parse a file like: 2 41620 . T G 100 PASS ...
1
vote
0answers
14 views

Unable to locate package pnp4nagios

I'm having problems trying to find the pnp4nagios package. I don't know what to do. apt-get install pnp4nagios -y
1
vote
0answers
10 views

Shell script to create multiple accounts? [duplicate]

I'm looking for some help with a school project which needs a shell script to create 10 accounts (5 teaches and 5 students into different groups) along with respected passwords. I'm a true ubuntu noob ...
0
votes
0answers
33 views

Spelling mistake in ~/.bashrc

I am a newbie and I wanted actually install MeanJS but then I made the following mistake. I wanted to paste this in the terminal: echo 'export PATH=$HOME/.node/bin:$PATH' >> ~/.bashrc But ...
1
vote
2answers
49 views

Problem with using wildcards when I do CP command in Terminal

I am new and try to learning Terminal Command. Today I faced some problem with cp wildcard command option. I wrote in Terminal this command cp Downloads/[:alnum:] test/ Here, Downloads is the ...
0
votes
1answer
29 views

How do I write an output of one command into a file? [duplicate]

Let's say we got a content of the following command in bash, which consists of several rows, and just one column: tacmd listsystems | grep -i $i | awk '{print $1}' This content is a list of offline ...
3
votes
1answer
126 views

How do I show the git branch with colours in Bash prompt?

I am using this guide to show the branch name in gnome terminal (Ubuntu 15.10) when working in a git repository. Based on the above I now have the below in my ~/.bashrc file: # uncomment for a ...
1
vote
1answer
16 views

Cannot backup using Duplicity via cron

I am trying to run a backup script foo.sh via cron. The code is as follows: #!/bin/bash export PASSPHRASE=password123 duplicity ../learningbash file://../../../media/kingston unset PASSPHRASE Then ...
0
votes
1answer
15 views

How to check network usage over past X minutes

I have a media PC (that is also a web test server on the LAN) that I want to reboot every so often as long as it is not in use. I have tests in place for the server using kodi, myth etc (its the ...
0
votes
1answer
29 views

Why can't I explicitly source a file using su -c?

I'm trying to get su to source /home/ghost/.bashrc, but it doesn't seem to load the contents: $ su -l -c 'source /home/ghost/.bashrc; nvm' ghost -su: nvm: command not found I use nvm to manage Node ...
0
votes
0answers
16 views

How do I navigate between directories in terminal like zsh of oh-my-zsh by TAB navigation, but using bash?

I want know how do I navigate between directories in terminal like zsh of oh-my-zsh by TAB navigation, but using bash? I know oh-my-zsh, its directories navigation works perfectly via TAB completion, ...
0
votes
1answer
23 views

mariadb-server syntax error

I am writing a bash script and having trouble with $PASSWORD. Can anyone please tell me the correct way to write sql lines in bash script? QUERY="GRANT ALL PRIVILEGES ON db.* TO 'user'@'localhost' ...
0
votes
0answers
9 views

How do I find which serial port my Arduino is connected to with a shell script?

I'm writing a little script right now which sends some data to the Arduino through a bash shell script. The command that sends the data looks like this: alias led_green="echo -e -n '\x10' > ...
0
votes
1answer
22 views

Interpreting !12 as string and not as terminal history

Using the sample command below in curl, it doesn't work as expected: curl -ik "http://localhost/index.php?username=parto&password=hello!23" I expect the parameters to be passed to include: ...
-1
votes
1answer
27 views

Print a String on Its Own Place in Unix Shell [on hold]

I'm trying to print contents of a text file(actually its strings). I'm familiar with some commands like grep, awk, sed; I forcibly want to echo string on its original place in file and I couldn't. You ...
7
votes
5answers
424 views

Bash - Check directory for files against list of partial file names

I have a server which receives a file per client each day into a directory. The filenames are constructed as follows: uuid_datestring_other-data For example: ...
0
votes
2answers
43 views

How do I change a variable of a background function?

I have been working on a script for my father that manages several tasks through a script with many functions that chain together (organization purposes). This script relies entirely on zenity for all ...
0
votes
0answers
13 views

Upstart Ruby version issue

I am trying to get Upstart to fire up Sidekiq (https://github.com/mperham/sidekiq/wiki/Deploying-to-Ubuntu). I can manually start it but the same command fails in the Upstart script. I have piped ...
0
votes
1answer
29 views

Bash script not running [duplicate]

So I'm pretty new to ubuntu and I'm trying to make a simple bash script that all it does is running Rubymine so I don't have to write it down in the command line everytime and also so I can have it on ...
0
votes
0answers
27 views

(standard_in) 1: parse error with bc

I am a new user bash. I want to divide two numbers, I used bc -l to take the decimals but I have this error: (standard_in) 1: parse error. This is my script: for res in {1..52} do cut ...
0
votes
1answer
16 views

No permission to write to serial device

Getting error "Permission denied" while writing to serial port from command line. I do : echo aaa > /dev/ttyS0 or even sudo echo aaa > /dev/ttyS0 but get the same result. How to solve this ...
0
votes
0answers
14 views

setpath in .sh script is not working [duplicate]

This is my .sh script. #!/bin/bash export PATH=$PATH:/home/srilm-1.7.1/bin When I am using this script file I could not add the environment variable path for temporary purpose(though the script is ...
3
votes
2answers
73 views

Can a Zenity list display a string `--option`?

Is it possible to have a Zenity list-style menu show a code option like -r? I am trying to make a simple GUI for an FFMPEG bash script. This is just one prompt for selecting a framerate for a video. ...
-1
votes
1answer
47 views

I can't use the ./ command in USB flash drive [duplicate]

I recently got Linux, and wanted to run the game dwarf fortress in my USB flash drive. To run dwarf fortress on Linux you have to use ./df in the dwarf fortress folder, but when I use this command it ...
0
votes
2answers
25 views

Save terminal output to variable in expect/tcl

Hej all, I have to use an interactive program and I want to automatize it with expect. My experiences in Linux and scripting is not the best. So this is the program output: enter minimum ...
0
votes
0answers
14 views

Shrink Terminal Prompt Path [duplicate]

This has crept up on me over the past many weeks to the point I am getting annoyed by this lengthy string as it gets in the way of reading the output messages. Here is what my Terminal looks like: ...
0
votes
0answers
17 views

Bash script: How to concatenate input parameters with strings? [duplicate]

I want to define an alias bak_log which uses an input parameter to backup all files starting with such string I can't find the way to concatenate the input parameter with other strings in order to ...
-5
votes
0answers
47 views

How do I write a shell script that creates a new user and adds it to a group based on input? [closed]

I need to write a script for creating a new user and adding it to a group. The script needs to ask for two information: the username; whether the user to be created is a student or a teacher. If ...
19
votes
4answers
3k views

Why does 'ls > ls.out' cause 'ls.out' to be included in list of names?

Why does $ ls > ls.out cause 'ls.out' to be included in list of names of files in current directory? Why was this chosen to be? Why not otherwise?
0
votes
3answers
52 views

How do i efficiently use environment variables?

I'm curious about learning about choosing correct env. variables. How to make out setting what env. variable would get the job done Example: if you want to make sure that command history always ...
0
votes
0answers
37 views

Bash script not working with shortcuts

My bash script is working flawless when i call from terminal. However, when i create shortcut to it acts weird. #!/bin/bash url="" function uploadImage { url="$(curl -s -F "file=@$1" ...
0
votes
1answer
23 views

Crontab isn't working with simple bash script

I am not quite sure what I am doing wrong. I am trying to create a cron job to run a bash script. The bash script will basically check my file (ip.address.txt), find my public ip address, then check ...
14
votes
1answer
1k views

What does this “printf” command do?

I was going through a tutorial and there I came across a command: printf "%(%s)T" The output of this command is: 1454299615 Could anybody please tell me what is this command and what the output ...
0
votes
0answers
39 views

Changing the color of root prompt in terminal [duplicate]

If I'm going to edit the bashrc file, where do I place the color codes to change the color of the root prompt (and not the normal prompt)? I already have the color for normal prompt changed. But when ...
1
vote
0answers
20 views

script to open terminal with multiple tabs and different directories

I find myself opening the same set of terminals every time I startup. I have 3 tabs in a certain directory, all with python venv's activated, and then one extra tab for ssh'ing if I need to. It ...
0
votes
2answers
17 views

How to loop file names into an array or run custom code on it

This is a qna post (Do not need help, just wanted to help others). Recently worked with some files and had difficulty in reading the files #version1 (error on files with spaces) arrFiles[0]=0 ...
4
votes
1answer
102 views

Moving files with bash scripts

I have a bash script that watches a folder, if something is added to the folder, the script will move all contents withing the monitored folder to the defined destination. I have a few of these ...
0
votes
2answers
34 views

Add android-studio/bin/ to PATH environmental variable

Recently I installed Android Studio. Now I want to add android-studio/bin/ persistently to PATH environmental variable as Session-wide environment variables and not as System-wide environment ...
2
votes
0answers
39 views

how bash is started in gnome terminal [duplicate]

I found out today that $- gives the options with which bash was started. $ echo $- himHB I would like to know in which file these options to bash were set or which file runs bash with these ...
0
votes
1answer
18 views

Are you sure you want to proceed? on login after editing .bashrc

Why am I being asked Are you sure you want to proceed? on login? I just edited .bashrc and added below given line in it. gnome-terminal -e "sudo -i mount -a" Thanks in advance,
0
votes
0answers
28 views

variable exported in sourced file not available

I have a script that contains the following: #!/bin/bash source $HOME/.bashrc echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" This script is run on @reboot by cron, with output redirected to a log file. ...
0
votes
1answer
11 views

ECHO behaviour with and without double quotes with hex

Can someone help me to understand behaviour of echo? I am trying the following commands in Ubuntu: $ echo -e \xaa xaa $ echo -e "\xaa" ▒ $ As you can see, with double quotes, while printing ...
0
votes
0answers
14 views

How can I run a sudo command without entering a password? [duplicate]

I created a script that I wanted the system (Ubuntu 15.04) to run immediately after I log in, so I add the scripts to the "Startup Applications preference". However, the the script has some command ...
1
vote
1answer
19 views

Keyboard shortcut for ruby script

I have some problem here when I'm trying to make a keyboard shortcut for my ruby script. So the first step I've do for it was to make a alias and add that command for alias on file .bashrc alias ...
0
votes
0answers
23 views

Automatically download/torrent files in Ubuntu 14.04

So, I have a Ubuntu 14.04 machine at my house running an FTP server, and sometimes I'm away from it, so, I want to set up several directories and make a script to automatically run any bash scripts I ...