Bash is a free shell for Unix-like operating systems from the GNU Project.

learn more… | top users | synonyms

0
votes
1answer
36 views

Piped awk command works as one-liner but not in loop

I have a part of a script that isn't working as expected. It's supposed to take a list of newline-delimited episode paths in the format "/volume1/Shared Files/Cartoon/Show Name/Show Name SXX/file.mkv" ...
-1
votes
1answer
23 views

I am trying to embed a patch in a bash script - can't get patch to read the patch from a variable

read -d '' PATCH_OS <<EOF //PATCH//TEXT// EOF patch -b < ${PATCH_OS} This fails: ./script.sh: line 39: --- //PATCH//TEXT// (line 39 is "patch -b < ${PATCH_OS}"")
0
votes
1answer
31 views

Add character to end of nth line in terminal

I'm trying to add a number of spaces to the end of the N:th line of a file from the command line. Can anyone show me how to do that?
0
votes
2answers
41 views

How to run a command in a new gnome-terminal?

I want to run some commands on some servers. So, I created a bash file: #!/bin/sh for n in `cat ~/nodes`; do gnome-terminal -x ssh root@$n ANYCOMMAND done The connections are ...
0
votes
1answer
29 views

Bash script failure

I have this script. It works fine on one of system but it's giving some error on another machine: 1 #!/bin/bash 2 EXEC_DIR=`dirname ${0}` 3 source ${EXEC_DIR}/config.sh 4 5 ...
0
votes
0answers
24 views

programmatically configuring osx loginwindow

I wonder if one can devise a tool for system administrators to programmatically configure that the login window doesn't show user accounts' full names, but short names instead? This used to be ...
0
votes
2answers
21 views

Using “for in” to iterates files but except specified one(s) in shell

I found a post here How can I run mogrify, but prefix the filename? which is talking about resizing a batch of images. In it there's a for in shell script. How do I except some single file(s) while ...
0
votes
2answers
35 views

How can I pass the result set of filenames from an MySQL query to zip in Linux

My problem is pretty straight foward, and I think I'm close but need a boost in the right direction. I have a MySQL table that contains a lot of file names that are used by a website. These files all ...
0
votes
1answer
28 views

Bash last command - skip identical commands in history

By using the arrow keys one can fill the command line with the last called commands. However, Bash does call all the previous commands, not just unique commands. $./a.out //oldest command ...
2
votes
1answer
34 views

How to set up an ssh server ON OS X

I'm planning on making a bash script that sets up an SSH server. The script is only meant to work on a computer running OS X. With the research I have conducted it seems like you have to use the GUI ...
0
votes
1answer
26 views

Change R BLAS library path

Currently the R on my system using this library for `BLAS': ldd /usr/lib/R/bin/exec/R libblas.so.3gf => /usr/lib/libblas.so.3gf I want to change the path to use ACML. Is it possible to change ...
0
votes
0answers
36 views

Highlight bash output in iTerm 2?

I've followed the instructions for installing Solarized on iTerm 2, on my new OSX Yosemite machine. It looks as though the background and basic colours are being applied, and $TERM produces ...
4
votes
1answer
179 views

Find and delete folder but not content

I'm trying to find all folders named b and delete them, without deleting their content (whether folders, files, hidden files, ...). So for example, a file in a path /a/b/c/file should become ...
10
votes
4answers
592 views

Is it possible to print out the shell expansion?

I know there is a specific set of rules that shell expand the commands user typed. (let's talk about bash shell.) Is it possible to print out a command in the form after shell expansion? It seems to ...
0
votes
1answer
26 views

Is it possible to 'source' the output of a python script

I have a large python codebase that knows a lot about my working environment. I would like to use it to set up my ZSH session when i open a terminal window. The python script would output text that ...
0
votes
3answers
57 views

What's the Bash equivalent of “cmd /c”

I'm trying to launch a Bash Shell window that should immediately start a Windows Application. It's the Bash Equivalent of "cmd /c MyApplication.exe". MyApplication is a Windows Console application. I ...
0
votes
0answers
57 views

Unable to run script, which emails me results, as super user. (returns: send-mail: 550 5.1.0 Not our Customer)

I have been trying to debug this for 2 days now, without success. This is the script I'm trying to run: #!/bin/bash emailaddress='my_username@gmail.com' output=`sudo rsync -av --delete ...
0
votes
0answers
33 views

Theme problems with vim and terminal

everyone. Trying to figure out a weird problem I'm having with VIM, that's probably just me being a complete novice with the program. I started using it today, and was told to use Vundle to manage ...
0
votes
2answers
35 views

Counting the number of open files for each user?

I am looking for a command that would list me number of open files for each user, sorted descending. For example lsof -u postgres | wc - would list them only for the postgres user, but I do want to ...
1
vote
1answer
54 views

Bash loop through all directories within a directory and if find any instance of string in each directories specific file do this

I have a service that utilizes a unique user specified port for remote connections. I install multiple instances of this service and wrote a bash script to automate the installs. My installer has a ...
2
votes
1answer
37 views

How to write a function that writes both to console and log file?

I'd like to write a function that writes a message both to console and log file. My initial attempt was this one: function log_write { local message=$1 local log_file=$2 echo "${message}" ...
0
votes
0answers
39 views

How to make an application accessible for ISPConfig's shell user?

We are using ISPConfig to manage our VPS. We have created a domain with a shell user assigned to that domain. There is an application installed on the VPS that is called drush (shell application for ...
0
votes
0answers
34 views

PHP - Exec on user's GUI session

I am trying to get a PHP script to execute an Applescript which opens an application.* PHP is running under the _www user. And while it can execute Applescripts with the osascript command, it can't ...
1
vote
1answer
35 views

BASH Script: Why Do My Variables Not Work

I'm trying to use some script variables in a BASH script to my code more clear. However, for some reason, my variables are not being expanded/uses. Nothing simply happens when I use the variable to ...
0
votes
1answer
33 views

Why chain of commands that runs fine on local doesn't run on SSH?

There's something funny with tail -f and grep -o combination when running over ssh. So on local server, if you do tail -f /path/myfile.log |grep -o keyword It grep just fine. But if you run it on ...
0
votes
0answers
22 views

Linux file “.bash_eternal_history” truncated?

I wanted to save all of my terminal activity on my linux system (ubuntu 14.04 LTS), so I read about the existence of the ".bash_history" and ".bash_eternal_history files". I read from here an ...
6
votes
3answers
729 views

Where are shell functions stored on Linux?

At first I was looking for the reason that which doesn't output anything after giving it certain programs as an argument, e.g. cd. From what I've found here, the reason probably is that cd on my ...
0
votes
2answers
35 views

Text deletion between patterns across multiple lines with respect to text inside pattern

I have a block of text I need to delete, however, only if it contains specific text inside the block: ... <script language="JavaScript"> var somethingA = 0; var somethingB = 0; var ...
0
votes
1answer
55 views

none of the commands work in linux terminal

All of a sudden I can't execute any command in my debian terminal: pi@rpi ~ $ ls -bash: ls: command not found or pi@rpi ~ $ sudo omxplayer -r -o hdmi mymovie.mkv -bash: /usr/bin/sudo: No such file ...
0
votes
2answers
40 views

bash: How to use a quoted argument in select

From a command I get some arguments that I want to offer to the user with the select statement from bash in a shell script. The arguments supplied by the command may contain spaces and are therefore ...
1
vote
1answer
42 views

How can I use the pipeline output from different commands inside a custom bash script?

I have this simple script: #!/bin/bash # This command removes the last "\n" (line feed) character from the file specified as parameter # # Params: # $1 [FILE_NAME] - the name of the file to trim if ...
1
vote
0answers
19 views

Gnome Terminal tab completion placing text in odd areas

Using tab completion in gnome-terminal appears to be placing text in odd areas, such as to the left (on top of my prompt) or above, sometimes. Here is an example of what happens when it places it over ...
0
votes
1answer
19 views

Mac .bash_profile.save How to make it run by itself / where to actually change paths

trying to change my path for Ruby / SASS. I have always used a file in my home called '.bash_profile.save' In there I have the export paths which work fine but only when I run: source ...
1
vote
1answer
47 views

tar complains “No such file or directory”

I'm using bash on Windows (distributed along with msysgit) to zip log files - one archive per date. Problem is, following script does not work and I have no idea why. Cut is here to get part of the ...
1
vote
3answers
47 views

Two very similar lines of sed, can they be combined?

I have the following two lines in a shell script and was wondering if there was any way to condense them into one using sed. I am not sure if there is a wildcard or anything that could replace the ...
1
vote
1answer
379 views

How to update bash on Mac OS X Yosemite

Just trying to learn bash scripting a little. My old bash version: Bash version 3.2.53(1)-release... I've updated my bash on mac os x yosemite with homebrew: brew update brew install bash Then ...
0
votes
1answer
37 views

script to disallow mounting of certain idVendor

I'm trying to write a script to disallow mounting of certain usb thumb drive's brand like silicon-power my thought was to use tail -f /var/log/messages and grep it to idVendor and blocking it upon ...
3
votes
3answers
172 views

how to select nth result on command line without using mouse

I got this alias for searching for a file recursively and case insensitive type fr fr is aliased to `find . | grep -i' and so let's say i'm searching for a file fr nsstring+util ...
2
votes
1answer
86 views

How to delete old $PATH echo in Mac

After i changed my Mac username(using the way supplied by Apple Documents), I found that when echo $PATH, there are some old paths in it. ...
2
votes
2answers
51 views

Executable lauches if called directly from terminal, but does not work when called from shell script

I have downloaded some software (called samtools) and it is stored in a folder on my desktop. Then I've added the path to the executable into the PATH environment variable. In other words my ...
0
votes
2answers
31 views

What's the smartest way to copy-rename (backup) several files in different folders at once in the shell?

I want to copy-backup several files in different folder at once before updating ntpd. Example (one file only): sudo cp /usr/sbin/ntpd /usr/sbin/ntpd.old Files: /usr/bin/sntp /usr/bin/ntp-keygen ...
0
votes
0answers
17 views

Staret managed server using Jenkins

I am trying to start web-logic managed server from Linux system. for that I have one shell script start_wls_managed4_btwnpmd01.sh with following code. ...
1
vote
1answer
41 views

Programmatically starting 6 servers and manipulating Gnome Terminal

I would like to make a script ( bash ) that will programmatically start gnome-termal with 6 tabs each with its own title start a different command in each tab delay starting server 5 until sever 4 ...
1
vote
2answers
39 views

Remove directory that is listed as “No such file or directory”

I have a folder on an external harddrive that has a curious folder in it that shows up as "No such file or directory" when I do a directory listing. See screenshot below. How do I remove this ...
1
vote
1answer
45 views

bash script processing files with bad characters

I received a zip file with a folder structure that include parenthesis. I've worked through two processes at the cli and now merge them into a script The first searches through the file structure for ...
1
vote
1answer
34 views

Is there a limit to how many “../” back-directory references you can make?

I've never noticed this before (and I've been using Linux as a primary OS since 2008). Is there a limit to how many back-directory references you can make with ../? Why? I moved a file only for it ...
1
vote
1answer
89 views

Bash script starts my program two times

I have a custom daemon program in C, which is a daemon. The usage is as follows SampleGame /directory1/ /directory2/ /directoryN/ I've made the same into a bash script. When I start it, the ps ...
1
vote
1answer
50 views

How to get different prompt look for root and regular user

My .bash_profile has different styles of prompt for regular user and root but in order it to work the .bash_profile should be reloaded every time I switch users. How can I achieve this? Can I make ...
1
vote
1answer
42 views

Why is my bash history not sorted by date?

My mac bash history looks like this (I'm copying just the last +100 lines): 2769 23/09/14 17:54:09nano ~/.bash_profile 2770 23/09/14 17:54:21nano ~/.bash_profile 2771 23/09/14 17:54:28source ...
0
votes
2answers
73 views

find /data/oozie-admi/ -type d -ctime +1 | xargs rm -rf [0] command deleted /data/oozie-admi/ folder

/data/oozie-admi/ folder contains multiple directories. This command find /data/oozie-admi/ -type d -ctime +1 | xargs rm -rf [0] deleted /data/oozie-admi/ folder . Need to find out scenarios in ...