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

learn more… | top users | synonyms (1)

0
votes
1answer
17 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
4 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
14 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
vote
2answers
46 views

How to check if script was executed via command line or double-clicked?

How can I determine if a script was invoked from a command line or via double-click in file manager (Nautilis)? If the former, I still have a command prompt when the script finishes, but if it was ...
0
votes
1answer
19 views

Print a String on Its Own Place in Unix Shell

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
360 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
0answers
16 views

Specification of Shell variables [duplicate]

I know the environment variables are located in /etc/environment such as PATH. Where can I find the configuration file of specific shell? Few places maybe /etc/profile, /etc/bash.bashrc, ...
0
votes
2answers
41 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
9 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
23 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
15 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
70 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
46 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
18 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
45 views

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

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 ...
18
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
50 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
35 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
20 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
30 views

Changing the color of root prompt in terminal

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
101 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
33 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
15 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
10 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
17 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
22 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 ...
-2
votes
0answers
30 views

Bash script to insert letter based files into directories [closed]

I'll start by saying I'm a complete novice to this. So basically, what I need to do is create a script that makes 15 directories (named from 1 to 15) and inside each directory I have to have a letter ...
8
votes
1answer
397 views

How do I open the man page for square brackets math and what are they called?

I have been working with them for a while now (math equations in $[], not the arrays) arrConflicts[0]=$[arrConflicts[0]+1] currentCombination=$[ (arrFiles[0]-1+arrFiles[0]-i)*i/2-arrFiles[0]+j ] ...
2
votes
1answer
26 views

Shell script needs to be run twice to work as expected

I have the following shell script: #!/bin/sh # 1. Kill the process along with the screen /usr/bin/pkill -f reportPrintingServer.jar # 2. Start the printing server again. /usr/bin/screen -S proRps ...
0
votes
1answer
26 views

tor command is not starting Tor Browser

I wanted to install Tor on my new Ubuntu (14.04) install. I followed all the instructions and tried to start tor. It starts correctly if I navigate to Tor's directory and run: ...
0
votes
0answers
12 views

Sudo, nohup and spewing detached processes

I have a jar file that I need to routinely kick start from the terminal, and needs to be run as root. I'd also like to leave that terminal open for use, so I'm using this bash script: $ cat ...
2
votes
1answer
29 views

Why to use bash in executing script? [duplicate]

In a former question, I was suggested to execute: sudo bash start-dfs.sh why not sudo start-dfs.sh ? I mean, what difference does bash makes?
0
votes
1answer
36 views

Putty SSH client command history? [duplicate]

I connect to my server via Putty SSH client. With the key ↑ I see previous entered commands, one by one. I just wondering is there a some command, which show all previous entered commands out of a ...
1
vote
2answers
35 views

How to know what options each command has?

I've been using linux for quite some time now and I have a question burning in my head. I'll use the mount command as an example. When you see the manpages of mount it says that you use the command ...
5
votes
1answer
58 views

Serialise shell commands

I'm looking for a way to "stack" commands from the terminal prompt so that only one at the time is executed: First enter a command, press enter, execution starts, back to shell (like &) I can ...
-2
votes
0answers
18 views

Command to display the first ethernet network and the first wireless network interfaces' names [on hold]

For a Bash script I need a command that displays the first ethernet network and the first wireless network interfaces' names. For example, for my actual laptop the output of this command would be ...
0
votes
1answer
20 views

How can I scan all connected USB drives for a file?

I have an install of Ubuntu and I would like to run a script (bash, perl, python, whatever) that will scan all connected USB drives and report if it finds a text file. Could anyone guide me on how to ...
1
vote
2answers
28 views

Terminal auto complete adds aditional \

I am having the issue with my terminal and tab auto complete. If I try to auto complete using TAB for any file or folder that has a space in the name it is adding an \ before the space. For example ...
0
votes
1answer
21 views

How to run multiple scripts each of which runs forever through one script?

Suppose I have the following two scripts: #!/bin/sh while true do #Do something sleep 1m done and #!/bin/sh while true do #Do something else sleep 1m done called First.sh and ...
1
vote
1answer
15 views

Jar print convert and print “$?” to 0

I have a clipscode which I want to insert in my database I wrote a Java prog for that and it is running fine in eclipse IDE if my clips code contains "$?" it preserved as it is in eclipse IDE. see the ...