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

learn more… | top users | synonyms (1)

0
votes
1answer
76 views

Copy unmatched strings in from one file to another, bulk

I'm trying to compare files from folder1 to their updated version in folder2. The files have identical names, but may have different number of strings. The strings look like: string_1_name: "some ...
4
votes
4answers
402 views

Can't run Bash script

I am trying to run a simple Bash script called deploy-site.sh (by http://klau.si/dev). I made the necessary edits to run it locally (change of WORKDIR, etc). I also followed the instructions here. ...
1
vote
1answer
29 views

Can't pass file containing whitespace as command-line argument to SMS-sending Python script in Ubuntu Touch in Ubuntu Touch

I can send text messages by SMS using the command: $ /usr/share/ofono/scripts/send-sms /ril_0 07123456789 "iorem ipsum est" 0 Where /ril_0 is the SIM card/modem, 07123456789 is the telephone ...
2
votes
1answer
32 views

What do numbers between parentheses in bash man pages mean: bash(1), ssh_config(5), sshd(8),

Most of bash commands have an help manual which can be opened in the command line by using the command man: man bash man ssh_config man sshd On the first line of every man page for a command, we ...
1
vote
3answers
45 views

echo to file works only with sudo su

I am using the Jetson TK1 development board from NVIDIA which has Ubuntu 14.04 on it. It is a 4-core ARM system and by default, 3 of them are "offline" - ubuntu@tegra-ubuntu ~ $ lscpu Architecture: ...
0
votes
0answers
25 views

ssh connection: trigger event/invoke shell script at predefines intervals

On the server side I am trying to achieve something like : after x hours of a user being logged in via ssh I would like to execute a shell script. And I want this time to be configurable per user ...
1
vote
5answers
166 views

Pass filename from bash to python

Lets say I have 1000 csv files that have random names in a folder test. and I have a python script script.py. I would like to write a bash script that would pass the name of each file in the folder to ...
0
votes
1answer
26 views

BASH: boolean statement unexpected behavior when checking for whether a directory exists

I have to get some files from a device and store them in a directory with a particular name. I'm writing a script that does this, but one of the first things it does is it checks if the directory with ...
15
votes
4answers
2k views

What is `$?` ? Is it a variable?

The question is pretty straight forward. I can get the exit code of the previous command by using $?. But what exactly is it? I don't think it is a variable, because you can't have any special ...
0
votes
1answer
18 views

BASH - catching errors

How can I have a script react to an error being thrown? Equivalent to Java's try and catch, but for BASH. So, something like: <Some Command> if <Some Command> throws error #Do ...
5
votes
1answer
125 views

How do I run a bash or python script via cron, visible on the local desktop

I have a production server that runs several bash scripts on the local desktop. Two scripts run all the time and don't need to be stopped. I have a third Python script that I need to start at 9AM. It ...
0
votes
0answers
32 views

Ubuntu 3.13.0-48-generic PATH Variable Not Working

I am trying to edit the PATH variable on a fresh Ubuntu install. For some reason it keeps throwing the error "No such file or directory" whenever I try to invoke my command. java;echo PATH=$PATH;echo ...
2
votes
1answer
30 views

How to multiply negative numbers in bash

This is my script for multiplying negative numbers #!/bin/bash p="1" h="-10" z=$(echo "(($p)*($h)+2"| bc -l) echo $p $h $z and this is the result (standard_in) 2: syntax error 1 -10 how to ...
0
votes
1answer
29 views

How to subtract float values in shell script

I have a script which uses float values but some how i am not able to subtract two floats. This is the sample code #!/bin/bash p="1" h="10" m=$(echo "3.5"| bc -l) for (( c=$p; c<=$h; c++ )) do ...
2
votes
1answer
39 views

Find and replace special characters in a directory

I have a number of Windows based .m3u playlists - they start with ..\..\ and have \ instead of / for folder paths, whereas Ubuntu prefers they start with /media/usr/part/dir/ (i.e. the absolute path). ...
14
votes
2answers
491 views

What's the missing argument to -exec?

I use the following command to clear a directory, of files and directories over 30 days old, and move them to an archive directory which I can delete after a few weeks if nobody asks for their files ...
0
votes
0answers
29 views

Executing Pure Data Patch from within Python/Shell on Raspberry Pi

I am searching for a way to execute a Pure Data patch from within a Python/Shell script. I have the PD patch (called sf.pd) on my Pi in a folder called /home/pi/pd. To execute the PD patch from the ...
2
votes
1answer
30 views

Bash completion for commands that start with specified letter?

Is it possible when I press Ctrl+r and after this, for example, press the letter a, then using the up and down arrow key to search only the commands in the history that start with a? Or if I type ssh ...
0
votes
1answer
21 views

get a tab out of a vector

if I have the first line of my file looking like this NAMES n1 n2 n3 betwen row1 and t1 there are two tabs but there should only be a single tab...the line is in a larger file it is ...
1
vote
1answer
37 views

Error with #!/BIN/BASH MAC [closed]

I am trying to host a unturned server, and I watched a tutorial on youtube. So that is what I wrote in textedit for the launcher of the server (a .command) : #!/BIN/BASH ...
0
votes
1answer
30 views

Bash Script for Dump Several Processes on Android Devices

I have created three bash script for dumping several processes that runs in the Android device. The first bash script: #!/bin/bash echo "adb forward tcp:8888 tcp:8888" adb forward tcp:8888 tcp:8888 ...
0
votes
1answer
20 views

How can I create a shortcut that acts as a tally

For my work I have to do repetitive tasks with weekly deadlines. I like to know how close I am to finishing these tasks so I tend to keep a tally on a piece of paper. Unfortunately I travel a lot and ...
0
votes
2answers
25 views

Run a .sh file depending on the content of a file

I want to create a .sh file that needs to have a look into the content of a different file, in this case is the postgresql configuration file. Is there any way that I can run a command within the .sh ...
0
votes
1answer
17 views

setting up VOCE api in ubuntu

I am using ubuntu 14.04 . I recently downloaded a speech recognition and synthesis api called voce. For installation it told me to run the build.sh file. When I run this script it pops out some errors ...
7
votes
2answers
88 views

Is it possible to make sandwhich aliases?

I'm looking for a way to make the following alias work for any file name. alias dim='cd /home/jason/Documents; vim *the desired file*; cd' I'm wondering if there is a way I could change this alias ...
3
votes
3answers
111 views

apt-file regex: escaping a dot

I want to find all packages which provide a shared object containing "ssl" in the file name. The apt-file manpage says: --regexp | -x Treat pattern as a (perl) regular expression. ...
-1
votes
1answer
37 views

Use of quotes when running commands on a remote machine using ssh

I have a command that I know works correctly when I remote into a machine and run it. The command is below: grep "SearchTerm $1" file.txt | sed 's/^.*SearchTerm $1,//g' | sort | uniq -c | ...
0
votes
1answer
63 views

Using Upstart / init with PHP daemon nohup php daemon.php

Till now I had no real need to learn bash and init scripts as I need to at this point. I have created a custom Twitter app that is persistently, or constantly, connected to the API. It does tasks like ...
2
votes
2answers
127 views

To understand the behaviour of script when running over SSH

Alright, lately I have been facing an odd behavior. I have small bash script which simply takes mysql dump remotely and then store data on the server itself which later get rsynced to backup server. ...
1
vote
2answers
78 views

Bash script and escaping special characters in password

I have been reading a lot of questions already asked here, however, somehow nothing is working for me. I have a bash script where I have to send password which dump database on remote machine, so its ...
1
vote
1answer
41 views

BASH->Python (2.6) piping

I need to translate this line of Bash into Python: sample1=($(/bin/cat /proc/meminfo | egrep 'MemTotal|MemFree|Cached|SwapTotal|SwapFree|AnonPages|Dirty|Writeback|PageTables|HugePages_' | awk ' { ...
2
votes
1answer
45 views

command output based on pattern

Consider I have a command with some pattern, for example: $ grep "some string" file-[0-99] how can I write result into a file that will have its name based on the current value of a pattern, so ...
0
votes
3answers
53 views

Compress folders older than x days

In /opt/abc I have a path where a new folder gets created daily. In that folder a series of files gets created. I would like to run a script every Sunday at 02:00 and compress each folder which is ...
3
votes
1answer
50 views

.desktop launches app with custom icon. why not shell?

I have a .desktop file that launches an app, and it uses the .desktop icon: [Desktop Entry] Name=My Ro Type=Application Comment=Web Application Exec=/path/to/myapp -test Icon=/opt/giteye/icon.xpm ...
0
votes
1answer
46 views

MySQL Crontab Check

I have a serverpilot.io server running from digitalocean (1gb Ram), MySQL will crash once a week, the stats say the server is using ~256 mb out of 1 gb, but mysql will crash saying out of memory.... ...
2
votes
2answers
136 views

How to set JAVA_HOME for all users for “elasticsearch” program?

I'm trying to set JAVA_HOME for elasticsearch but no luck till now. I tried to set it in .bashrc, etc/environment, etc/.profile all fail. this is the command I use to run elasticsearch: sudo ...
0
votes
1answer
34 views

Bash Script to search a webpage

I've Googled my problem, and it's getting more confusing. I want to write a bash script that will search this page for a specific string and echo if it's found. For example, if I wanted to search ...
2
votes
2answers
194 views

How can I discover where apt-get has installed applications?

I have installed 2 development tools named maven and ant using this command: sudo apt-get install maven ant How can I discover what are the installation directories for these tools on my system?
0
votes
1answer
37 views

How to set a permanent environment variable?

I am not yet a Linux guy and I have some problem trying to add a new permanent environment variable. So I have to set a new environment variable named CATALINA_HOME with this value: ...
0
votes
1answer
26 views

Rotate binary files

I'm trying to solve a problem with rotating binary files. I have video files which are recorded from IP camera, and I want to delete oldest files when I have less then e.g. 10 Gb of free space. ...
1
vote
0answers
27 views

Automatically switch to Singstar Microphones when they're plugged in

I am running a media computer for my sharehouse and since singstar has been so popular I want to run Ultrastar for everyone too. The problem is that getting the microphones set up can be finicky and ...
0
votes
0answers
42 views

Script for Opening Two Terminals and Execute Three Consecutive Commands [duplicate]

I intent to open two terminals and execute three consecutive commands in bash script. Basically, the first terminal will execute first command, second terminal will execute second command, and back ...
0
votes
3answers
76 views

Use of the Rename Command

I have a two part question. I have a series of files with the names "file.pdb.#", where # is an integer. 1.) How can I script to rename all the "file.pdb.#" to "file_#.pdb", where the integer is ...
1
vote
0answers
52 views

Different results of 'ps aux | grep x' if entered manually and done via script

It was probably a bad method, but I was running ps aux | grep x | wc -l as part of the if statement in a script. When I ran this from the command line as a regular user, the result would be 1 if the ...
0
votes
0answers
58 views

Sorry, user is not allowed to execute X as root on lt

Whenever I try to run a command from the termainal as sudo, I am now getting the error: Sorry, user {user} is not allowed to execute {command} as root on lt. lt is the name of my computer. The only ...
2
votes
1answer
37 views

How can I be sure “apt-get install” successfully finished its work?

I have Ubuntu 14.04 and I intend to download Skyrim. So I put the command into the terminal sudo apt-get install playonlinux. Everything was loading fine and it seemed to be working, however before ...
0
votes
0answers
40 views

Installing YADR on Ubuntu 14.04 error - prezto: old shell detected

I have a fresh install of Ubuntu 14.04 on VirtualBox, and I am trying to install YADR (https://github.com/skwp/dotfiles), which works really well on Mac OS X. However, after I finished installing and ...
0
votes
0answers
18 views

Standard LXC Container configs for shell scripting in Ubuntu?

I would like to do computation in neutral environment. I got a tip about Linux containers here. I am not sure how this project about Linux containers is managed, like who is the central board. ...
2
votes
4answers
65 views

Remove whitespace from all array elements

I have a array called arrayvar, which is being defined as arrayvar=( $(awk '/'"$vovar"'/,/}/ {gsub("'"$vovar"'"," "); gsub("}"," "); gsub("{"," ");gsub(","," ");print}' temp1 | tr -d '\n' | sed ...
12
votes
2answers
552 views

Non-sudo alternative to /usr/local/bin for common scripts

I'm used to putting common scripts in /usr/local/bin so that I can execute them from anywhere with the terminal. For example, I make a shell script named 1, make it executable with chmod +x 1 and put ...