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

learn more… | top users | synonyms

0
votes
0answers
46 views

How to parse pipe with multiple commands independently?

How can I parse output of a single command by multiple commands without truncating at each step? For example ls -al|grep -i something will pass every line that has "something" in it to the next ...
1
vote
1answer
46 views

How to wake-up remote IIS webserver using dd-wrt shell scripting

The problem: I have some asp.net websites hosted on IIS ( at a local hosting company). Now if nobody access them during aprox. 20 minutes, the IIS is going into sleep mode, so the first next request ...
1
vote
0answers
16 views

Restore Launchpad DB from Backup using Bash/Terminal?

Context: I'm using an OSX shell script to update my settings system-wide after a fresh OS install. One snag I've ran into is restoring Launchpad. I have my launchpad DB backed up via GoogleDrive at: ...
1
vote
2answers
48 views

How do I run commands in a script as another user?

I have a need to have a single script run the majority of its commands as another user, but do not want to instruct my users to call it via sudo. Running the commands with an EOF here document is not ...
0
votes
2answers
51 views

bash autocompletion + command history using sudosh on AIX

We configured sudosh on AIX as login shell with /usr/bin/bash as their default shell. All is working fine except bash autocompletion and command history are not working anymore. TAB is TAB, arrows ...
1
vote
1answer
91 views

Open Google Chrome Specific Profile From Command Line Mac

I have been trying to open Google Chrome from command line but with no luck! I have tried How do I start Chrome using a specified "user profile"? My goal is to open Google Chrome with a ...
3
votes
1answer
406 views

-bash: /etc/bash.bashrc: Permission denied I have no name

I have a Debian Wheezy server running, and a test-backup was just run - However, it went the other way! I cleaned it up the best I could, but I'm getting a VERY annoying error now. Root login is ...
0
votes
1answer
59 views

script to delete duplicate files using md5

I want to write a script to find duplicate files in a given directory and delete the copy depending on the hashcode. When I run the script it deletes the copy and the original file. Here's my code: ...
0
votes
2answers
64 views

Setting node path and allowing to run as sudo

I've got a raspberry pi that I'm running node on. I followed this guide http://joshondesign.com/2013/10/23/noderpi to install node. When I setup the NODE_JS_HOME, I can run node from the command ...
0
votes
1answer
51 views

How to send message both to netcat and other script?

I'm trying to make some client-server interface. Think of it as one-on-one chat. What I want to achieve are two horizontal views. Bottom for my (server) input, top for client output and my input. ...
0
votes
1answer
44 views

How can I install my script into the user's $HOME/.bin (or $HOME/bin) directory and make sure that is in their PATH?

Edit: places where I said $HOME/.bin I should have written $HOME/bin or any equivalent is fine. So I have a bash script which I am distributing as a client for my API. Current version installs like ...
2
votes
1answer
31 views

Are shebang invocations detectable?

Is there a way for a bash script to detect if it's being run via the #!/usr/bin/env shebang? Some magic bash foo that would let me write: #!/bin/bash ... if [ __INVOKED_VIA_USR_BIN_ENV__ ]; then ...
0
votes
1answer
56 views

Issue with RVM conflicting with Brew?

Please bare with me as I am not an expert on bash. In fact I'm fairly new to OSX < 1 year. I ultimately would like your help to get my system configured optimally, thus removing unnecessary tools. ...
0
votes
1answer
21 views

Passing VARS to another console on Fedora

I'm trying to source the config.sh file from a path that's defined in a variable. How do I get my variable to expand in the current console. Here are my commands: [root@mysystem]#export ...
1
vote
0answers
53 views

Edit text file contain unknown format

I have a text file when I open it with gedit warn me: and when I open with emacs: I have another file with this character and I want to remove this character from that file with a bash script.
1
vote
2answers
205 views

How can I “grep” recursively filtering the name of the files I want with wildcards?

When I want to perform a recursive grep search in the current directory, I usually do: grep -ir "string" . But that command searches inside all kinds of files, including binary files (pictures, ...
1
vote
6answers
82 views

Give execution permission to directories but not to files

I have a directory structure with files and directories and I like to assign permissions so all the files and directories have read-write permissions for the user and read permissions for the group ...
1
vote
0answers
9 views

Splitting tar archives and uploading them one at a time

I want to backup my systems to split tar archives with a script uploading them one by one. It has to create the split archive and then run a script. The script uploads the part and deletes it. This is ...
0
votes
1answer
23 views

Associate MIME Type with Shell Script?

I want to associate any file type with a .abc extension with the following shell script: #!/bin/bash echo arg 1 is: $1 The .abc type files just have text, but I want to ensure that opening a file ...
0
votes
1answer
18 views

lines disappear in the history of bash : is this a bug or a feature?

When I enter a command line starting with a space, the line does not appear in the history of bash (using the up arrow). Is this a bug or a feature of bash ?
0
votes
0answers
97 views

OSX OSX Mavericks: Cannot login: Corrupt password file: Recovery mode bash not working for resetpassword script

Running OSX Mavericks on Macbook Air SDD disk. The system has corrupted the password file so none of my six identities can log in - password invalid. Following discussions and tests with apple ...
2
votes
1answer
71 views

Bash Command line Editing [closed]

I have two questions. Q1. I read a article http://www.thegeekstuff.com/2014/05/linux-keybindings/comment-page-1/#comment-1750752 in this cntrl+/ works perfectly fine for redoing the last undone edit ...
0
votes
1answer
34 views

Linux Bash SSH - Why won't my port forwarding tunnel command work?

The commands I'm trying are: ssh -vxNn -L 8080:192.168.x.xx:80 hostname@server ssh -vxNn -L 8080:192.168.x.xx:80 hostname@server Where the "x" is masked for security as is the hostname and server, ...
1
vote
1answer
43 views

Bash script to check for shell access

I am working on a shell script to easily manage accounts. I want to have an option to enable and disable shell access (which is easy) but the tricky part is finding if an account already has shell ...
0
votes
1answer
60 views

Execute the shell command in subshell or in background?

Actually I mainly work with Ruby, but now I have created a bash script file. From this script file I am displaying the messages on the screen. Here is my scenario. I have used aosd_cat module for ...
0
votes
2answers
106 views

How to automate shell script to run when I open a particular app in OSX?

I've been running into a rut recently with one project I've been trying to accomplish. Using Automator, but I don't know how to exactly to go about this project. There's this script editing app called ...
0
votes
1answer
48 views

How do I call function after prompt for input in a Linux shell script?

The title says it all. After Im prompted, I want yes and no to respectively call a function. # Check to see if you ran this script before echo echo I need to know if this is your first time... while ...
1
vote
2answers
47 views

Function that interpretes trailing 'n' characters of a word as argument

Is there a way to pass the trailing n characters of a command to a function, so that it executes it as two commands? For example I define my function as abcx and whenever I enter abcxfoo to the ...
0
votes
1answer
32 views

How To Find SVN on my Mac

I'm very wet behind the ears on my Mac as I'm a windows developer. I'm trying to find out if I have SVN installed and where it is but I cannot even figure out this basic task. I've got a terminal ...
0
votes
1answer
32 views

not found error when executing bash script on Mac OS

I'm trying to build jDom-b4(a Java library) from the source with the script provided in the source. The content of script named build.sh: #!/bin/sh echo echo "Java and XML Build System" echo ...
2
votes
1answer
70 views

CD backward to named folder

Was wondering if there exists any *nix command (or script) that allows me change directories backward to a folder matching a certain name. For instance, pretend pwd is: ...
1
vote
2answers
36 views

How do I print multiple sections in a text file?

I have a text file looking something like this: *FILESTART line_a line_b line_c *INCLUDE file_A.key file_B.key *INCLUDE file_1.key file_2.key file_3.key *SOMETHING_ELSE line_x line_y line_z *END I ...
1
vote
1answer
65 views

sequential SSH command execution not working in Ubuntu/Bash

My requirement is I will have a set of commands that needs to be executed in a text file. My Shell script has to read each command, execute and store the results in a separate file. Here is the ...
0
votes
1answer
149 views

init.d script - Permission denied

I'm trying to create a init.d script for my server which should start/stop the teamspeak server and some node.js apps using "pm2". Here's my script: #! /bin/sh ### BEGIN INIT INFO # Provides: ...
0
votes
1answer
34 views

I accidentally put a space in my path then moved lots of files - where are they?

I used the following code to move a lot of files: sourceDIR=/Volumes/MCOOPER/data destDIR=/Volumes/MCOOPER2 /data for i in {1..6000} do mv $sourceDIR/run$i.mat $destDIR/ done Now all my files are ...
2
votes
6answers
69 views

Compute md5sum of every 1MB part of stream from pipe

I want to do checksumming of large files and stream in unix/linux, and I want get many checksums from every large part of file/stream, every 1 MB or every 10MB. For example, I have disk image, ...
0
votes
1answer
32 views

Unix : Avail Space of File mounts

Problem Statement This is regarding the space usage of file system mounted in Unix box df -h -> Gives the total usage/avail/used/used% of all mounts in unix server Is there any other way to ...
8
votes
5answers
1k views

What does the linux pipe symbol “|” do? [duplicate]

Here is a command that sorts files in a folder in reverse order ls | sort -r What does the | symbol in that command do? What I'm really looking for here is high level (easy to understand) ...
0
votes
1answer
27 views

Bash: multiple commands with pipe on 1 line

This command gets my ip address: who am i|cut -d "(" -f2 | cut -d ")" -f1 output: 10.22.184.126 this command sends a ZPL command to 10.22.184.126 on port 5964: printf ...
0
votes
0answers
7 views

Move all files in directory to date-time based structure [duplicate]

I am hoping someone here can help me with (hopefully) a simple task... I have a folder (/img/) with thousands of pictures in, and I need to move them into a date-time based folder structure based on ...
-1
votes
2answers
77 views

How can I change the “/” path in linux [closed]

When I type cd /, it changes my directory to a default one. How can I override the current settings so that / points to a different directory.
0
votes
1answer
56 views

Imagemagick text to file batch

I want to convert text to images, but the text varies. I would like to make this a batch job. This is my first stab at the problem: #!/bin/bash COUNT=$(ls -f *.jpg *.png *.gif | wc -l) for f in $( ...
0
votes
1answer
85 views

Shell script to check all the URLs from a file or list

I'm looking for a shell script to check a list of URLs and give output. For example: http://abc.com/index.php http://abc1.com/index.php I may place them in a separate file or inside the script. I ...
1
vote
1answer
84 views

How to execute a php file from a bash file?

My goal is to make a script that I can execute through a cron job. The script needs to find several killstat.php files in multiple directories and execute them. This is what I have so far: ...
0
votes
1answer
31 views

get a command process back after closing a session

Arrrgh! I'm using one of those drop down shells (guake, I think) on Linux. I'm dd-ing an SD card, and I accidentilly closed the shell session that was running that command. The light is still ...
0
votes
2answers
40 views

Why doesn't xargs on find work with a series of commands using pushd and popd to walk a directory subtree?

On a Linux Centos 4 machine, I am trying to create a simple bash command line to walk a directory structure below an arbitrary current directory and in each subdirectory touch a file, list the ...
0
votes
1answer
38 views

Error mounting in fstab Ubuntu

'm working on a bash class project which needs me to create 2 partitions in Ubuntu and make them be automatically mounted each time the systems boots with fstab. I got the following file which ...
0
votes
0answers
42 views

Can’t set color of vim

I've asked same question to stackoverflow but It evaluated offtopic at stackoverflow. http://stackoverflow.com/questions/23667728/cant-set-color-of-vim?noredirect=1#comment36357524_23667728 If it ...
0
votes
0answers
39 views

Bash Prompt : incorrect time displayed

Using the following prompt: export PS1="\n[$(date +%d-%m-%Y)] \u@\h [\t]\n{\w} [\!] # " and with TZ to my timezone : echo $TZ = America/Montreal The time on the prompt is OK at the start of a ...
0
votes
1answer
70 views

Using EXPECT script with a $ in the password

I'm trying to set a variable in a Linux bash script which includes a $ symbol, i.e. password is Gl@d1us$123 so PASS="Gl@d1us\$123". I can preceed the $ with a \ and it works fine, but when it calls ...