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

learn more… | top users | synonyms

0
votes
2answers
19 views

confused about variables in bash

I know that variables in bash have no type, but am confused about the value they are assigned. The following simple script works fine in bash #!/bin/bash tail -n +2 /cygdrive/c/workdir\ \(newco\,\ ...
0
votes
1answer
48 views

WGET/cron downloading webcamera file

our new town doctor put a web camera to his waiting room for people to see how much crowded it is. As my mom and grandparents go to this doctor, I wanted to download the files periodically and if they ...
2
votes
0answers
62 views

How to register shutdown script on Amazon Linux in AWS EC2

I am using Amazon Linux (RH-based distro) in AWS EC2. I followed the structure of /usr/share/doc/initscripts-*/sysvinitfiles to create an init script in /etc/init.d. /etc/init.d/do_something ...
0
votes
2answers
61 views

How do I determine in a shell script if a FTP host is up? [closed]

I need help writing a for loop to work with ftp. It needs to get its input from a text file of addresses. The scipt does not need to fully connect, just show if host is up or not. what I got so far: ...
1
vote
1answer
35 views

Can I use Cygwin as a replacement for Ubuntu, for bash script testing?

Next wednesday i'm having an exam on Operating Systems. In this exam there will also be a part bash-scripting. The teacher itself will test the scripts in a Virtual Machine running Ubuntu. Myself, ...
-2
votes
3answers
73 views

osx bash grep - finding search terms in a large file with one single line

Is there simple unix command line i can enter which lets me isolate say 512 bytes either side of a search term, even if there is only one "line" in a very large text file? Ok, this should be easy. ...
1
vote
2answers
30 views

How to make it so bash runs instead of asking where to run upon selection from file navigator

When I double-click on bash files on Linux Mint a pop-up appears querying whether I want to run in terminal, display, run, or cancel. I was wondering, how do I make it so for this particular bash file ...
2
votes
3answers
180 views

What exactly do the sudo -s command? and how is it used in this example?

I have the following doubt. In a tutorial related to a software installation that I am following say that I have to execute the following commands (I am doing it into an ssh shell, so this list of ...
0
votes
0answers
34 views

Why is there a bash process running in my Terminal if I use Zsh?

When I run the "top" command on OSX Mavericks, a bash process appears even though I am using Zsh, why?
-1
votes
2answers
27 views

What is the risk when editing crontab file without the “crontab -e” command?

I developed a script in which I add lines to the crontab file with echo command and I remove lines with sed command. I do not know the risk of that especially that I find in some web site that we ...
1
vote
1answer
21 views

Is there any way to redraw the text in a terminal window after resizing it?

Just a usability question really. You know when you are working in a terminal window and you decide to do some query that brings back a wall of text and you think to yourself... "that would be easier ...
-1
votes
1answer
37 views

bash script with lftp with redirected input

I need lftp to connect to a list of hosts from a list file which are in IP address format. Then, if a ftp server is up, log that address (and if possible, device type, in this case routers) to a text ...
0
votes
0answers
23 views

Logging/debugging the bash startup process

My bash shell sometimes takes quite a while to start, probably due to a lot of stuff happening in my various dot files (e.g. .bash_profile, etc.). Is there any way to properly log the bash startup ...
1
vote
0answers
29 views

Dtrace shows posix_spawn called with only 3 argument. Trying to launch by hand

I ran dtruss on a process that launches another one: the League of Legends Launcher starts the main game process with certain arguments that I can't seem to pass via the command line. What caught my ...
0
votes
1answer
26 views

bash scripting, run commands in all subfolders with selections

I need to run this command trjconv -s run.tpr -f run.xtc -pbc mol -ur compact -o unwrap for all the sub-directories following the naming pattern of us_0.0, us_-0.2, us_-0.4 ... us_-3.8. The ...
1
vote
2answers
76 views

Use alias source with relative path

I want to add an alias file to my project folder to quickly open and edit files in it with a simple shell command. To make it more portable, I would like to use only relative paths. I want something ...
1
vote
1answer
37 views

How can I determine via command-line if VBox Guest Additions has been installed?

In particular, I need to know in order to write a bash script to prompt the user to install VBox Guest Additions on a Ubuntu client if it hasn't already been installed.
0
votes
0answers
37 views

Detaching from a GNU Screen suddenly clears the terminal

I feel so stupid for asking this, but here goes: I updated my Ubuntu (Server) install today from 13.10 to 14.04. Before the upgrade detaching from screen did not clear the terminal and now it does. ...
0
votes
1answer
25 views

Removing files and directories that already exist in other directories

I need a help writing a script. So basically I have directories named by current date, like 01-06-2014 02-06-2014 and so on each of these directories has files and subdirectories inside. But sometimes ...
0
votes
0answers
22 views

Warning: the connection is closed, while running cron job

I have found on the Internet simple script to download wallpaper from bing and set it. #!/bin/bash # export DBUS_SESSION_BUS_ADDRESS environment variable useful when the script is set as a cron job ...
0
votes
2answers
39 views

Using a parameter multiple times in a single line bash command [duplicate]

I occasionally need to run a command such as: mv "very-long-file-name.x" "very-long-file-name.y" I would like to achieve this without repeating the very long file name twice... I know how to do ...
0
votes
1answer
30 views

Why does an ampersand in URL cause failure of some command in Mac OS X Terminal?

Why does an ampersand in URL cause failure of the following command? I want to open a web page by running Safari in Terminal, placing the URL as an argument. This works as expected: open -a safari ...
1
vote
1answer
55 views

How do I change the .bash_history file location?

I'm running CentOS 6.x and want to move the .bash_history to a different location. The home directories of my users are (because I run a VPS) in /var/www/vhost/<domain>.<tld> which is FTP ...
1
vote
2answers
59 views

Replacing every 10th pipe with new line in unix

Lets say I have fields: name, number, id I have a data file: name1|number1|id1|name2|number2|id2...etc I want to replace every 3rd pipe with a new line or '\n' so I get: name1|number1|id1 ...
1
vote
0answers
19 views

Reusing _kill completion in .bashrc fails

I'm trying to extend bash completion alias perf-connect-process="perf record -p"; alias pperf=perf-connect-process; complete -F _kill perf-connect-process; complete -F _kill pperf; by reusing the ...
0
votes
1answer
67 views

Delete file if number in filename less than xxxx

I have thousands files in format randomstring_XXXXXXXX.jpg where 'xxx' is unixtime (1388415305). Now I need to delete all files older than some (unixtime) date. Does anyone have a solution for this?
1
vote
1answer
33 views

Bash script to track ffplay position

I'd like some way to pipe the console output of ffplay to a bash script that parses it and isolates the current seek time and saves that number to a text file (I can put it in a RAM disk). It's so I ...
0
votes
0answers
48 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
48 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
19 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
52 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
102 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
443 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
64 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
67 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
54 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
46 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
57 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
236 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
84 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
10 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
25 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
110 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
74 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, ...