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

learn more… | top users | synonyms

1
vote
3answers
63 views

Is it possible to combine these two ssh commands into one?

I'm using bash on Mac 10.9.1. Right now, I execute these two commands to ultimately get to the server I want access to ssh me@intermediate and then once logged in, I execute ssh me@destination ...
0
votes
2answers
29 views

Get specific point in referer of apache access.log

How can i get referer from apache access.log whitout the "GET" and "HTTP/1.1"? cat $APACHELOGFILE | awk -F\" '{print $2} The Output is: GET /folder/xpto/ HTTP/1.1
0
votes
0answers
20 views

GNU screen command on path not found

When I use GNU screen in the following way, it works: screen java -jar .... but why does screen bukkit .... not work when bukkit is a executable script from my path ($PATH)? I've read here, ...
2
votes
1answer
30 views

Using xargs with $() - operator precedence?

Inspired by this question. The original question, in short, is "How to turn all :2f into - in all files within a folder". e.g. If I have a file ./abc:2fdef it should be renamed into ./abc-def. At ...
1
vote
1answer
31 views

What's the deal with terminal colors?

There are 256 terminal color escapes available: 8 "system" colors (0 - 7) 8 "bright" system colors (8 - 15) 216, or 6*6*6 "RGB" colors (16 - 231) 24 "grayscale" colors (232 - 255) The "RGB" colors ...
0
votes
1answer
31 views

How to make grep command return entire matching line

How can I make the command grep -w show the entire line that contains the match? I need to force pattern to match whole words, but I need to see all of the line. Here is my command: cat ...
0
votes
1answer
53 views

split a file by a line prefix

My data looks like this: 60 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 61 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 62 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 62 ...
0
votes
0answers
44 views

Wrong exit status from expect script

I developed the TELNET_TEST.expect (expect script ) in order to test TELENT connection on remote machine this script perform telnet on target machine wait for login and send password and make exit ...
0
votes
0answers
25 views

Bash script for repeated execution of benchmark

I'm working on a project involved with cloud instance performance. Currently running UnixBench on EC2 instances. For comparison purposes I require a benchmark to be run constantly on one instance. By ...
0
votes
1answer
51 views

screen capture full webpage rendered with firefox or chrome

i'm trying to think of a solution that will let me take full page screen shot of a website via a bash script. so far i have tried gnome-web-photo but it doesn't render the webpages correctly. next i ...
0
votes
1answer
26 views

writing a script to mail all users online

I am taking my first Linux class and we are writing scripts. Currently I'm trying to write a script that will look at who is online and then send them a mail This is an entry level linux class so ...
0
votes
1answer
43 views

Bash files open terminal when opened

This seems like something simple to do but for the life of me I cannot figure out how to do it. I would like all bash (*.sh, *.bash) files to open with a terminal to show their output in.
0
votes
0answers
38 views

CLI tools/ways for dynamically constructed DOM structure parsing HTML Javascript

I'm planning to make a tool which recognizes HTML using DOM structure in CLI. As many sites produce many DOM elements using JavaScript these days, it's becoming difficult to extract information from ...
0
votes
0answers
17 views

mc-wrapper does not exit to MC_PWD directory

I recently installed openSUSE 13.1 and set up the mc in typical why by aliasing mc with mc-wrapper.sh to have it exit into the last working directory in mc instance. However this does not seem to be ...
1
vote
1answer
21 views

Trouble creating real NTFS links using Cygwin

I have administrator privileges and would like Cygwin's ln -s to make NTFS links instead of the fake !<symlink> files that only Cygwin understands. I tried the following, based on Cygwin ...
0
votes
1answer
27 views

how come git bash can call java tools (xjc.exe) with unix paths but not cygwin?

From CMD.exe, I can run xjc as follows: xjc "c:/schema.xsd" -p abc -d "temp" From git Bash, I can run xjc as follows: xjc "/c/schema.xsd" -p abc -d "temp" As far as Cygwin goes, I can get it ...
0
votes
2answers
68 views

Is it possible for a root user to watch others' shell session secretly in live?

I see a similar question on stackoverflow: http://stackoverflow.com/questions/1353253/linux-terminal-how-to-capture-or-watch-other-terminal-session Someone recommends conspy. However, it seems that ...
0
votes
1answer
29 views

Bash doesn't source file unless manually started

bash won't source files from an login terminal unless I manually run bash from a terminal, I have bash (and not sh or dash). When I source a file, it returs errors (like "syntax error near unexpected ...
5
votes
2answers
289 views

Checking file names inside a directory with Regular Expressions

I have a list of files inside a directory and I want to make a bash script which uses a regular expression to check if every file name inside it has this syntax: xxxx_xxxx_xx_xx Where x are ...
0
votes
2answers
45 views

IFS-separated items in loop

It is recommended to use IFS to loop through comma-separated list, e.g. here. But, I see that sentences="Hello World,Questions" IFS=, sentences1=($sentences) # if we comment this line then loop is ...
0
votes
1answer
31 views

Unable to start bash script with shell_exec

I've been googling and trying to solve this problem with my php script for a few days now and I'm hoping someone here can see the problem I'm missing in getting my php script to kick off my bash ...
0
votes
1answer
31 views

How to capture diff output from find command exec?

I am using Ubuntu (Precise 12.04) I am trying to write some bash script to see if file is changed via awk replace by using diff command. I did a test with the following: #! /bin/bash diff fileA.htm ...
0
votes
1answer
42 views

Setting include paths in LSF-bsub

I am running a big job on a HPC. But the installed programs for the job are old versions and I have the new versions in my home directory. I can log in to any node, export the path to the new versions ...
0
votes
1answer
19 views

Backing up recursively is not copying directories

I have the following line in a script to backup and it is not recursively copying all the directories, it gets the files but just lumps them all together. Can anyone tell me what is wrong with it? ...
1
vote
1answer
44 views

Bash script - Trying get abuse email using whois command

How can I get only e-mail address from output? $ whois $IP | grep @ | head -1 notify: albert@xxx.sig.xxx.tw
0
votes
0answers
48 views

Batch replace non-ASCII characters in filenames

I'm looking for a shell script that will recursively replace non-ASCI characters with underscore or just remove them. The issue is that a drive with files, created on Linux, has to be used on ...
0
votes
1answer
37 views

How can I delete the oldest directory in a directory?

I am writing a backup programm, and I need to execute a bash command to delete the oldest directory in a specific directory. I have found this command to print the oldest directory: find -type f ...
0
votes
1answer
33 views

Bash script analyse apache log

I need help with this script This script analyses apache_access.log through a filter.txt, if exist the term in filter the script will do something. My problem i think is in the first command "for", I ...
1
vote
2answers
40 views

Execute a previous command in a shell and get the command directly after

Once, a colleague of mine shown me a very useful method (shortcut?) on a shell (bash? csh?) to, after executing a previous command, automatically show the command after in history. For example, ...
0
votes
2answers
36 views

using 'case $1 in' to read command options- multiple flags after dash, and handling unusual flags?

I am making a bash script which uses both long options and short flags. Since I want long options, I can't use getopts. I tried using the following code: while test -n "$1"; do case "$1" in ...
1
vote
0answers
40 views

How can I redirect OS X dtruss output when running with sudo?

I'm running dtruss on Mac OS X 10.9. Simple example is: sudo -c ls But I'd like to capture the dtruss output into a file. I saw something that suggests that I can do something like: sudo bash -c ...
0
votes
0answers
11 views

cygwin's chmod behaves as working, but it does not work

My Cygwin installation is behaving strangely: chmod does not work. [09:45 Administrator@DellIns14 ~] > ls -ls /usr/bin/chmod 64K -rwxr-xr-x 1 Administrator None 38K Feb 6 2012 /usr/bin/chmod ...
-1
votes
1answer
44 views

Using /usr/bin/env to change directory [closed]

I want to automatically execute commands with the prefix /usr/bin/env $/usr/bin/env composer install (this runs OK) $/usr/bin/env cd public (failed ---> /usr/bin/env: cd: No such file or ...
0
votes
1answer
66 views

'localhost' stoped working as an alias for '127.0.0.1' for SSHing into my VirtualBox VM from OSX. Why, and how to fix?

The question explains the problem. For months I've never had any problems along these lines. Then, yesterday morning, I couldn't get into my VM! Took a long time to troubleshoot but here was the ...
1
vote
1answer
47 views

linux: monitor logfile for a string and execute script

I want to monitor a logfile (syslog) on my linux debian box. So if there is a new entry with a secific string, i want to execute a script. The strings are "alarm start" and "alarm end" So it should ...
0
votes
0answers
23 views

Running Custom commands in a Terminal Application

I am running a terminal application in /dev/pts/X terminal that has its own console as sampleapp> what I need is to run commands specific to this application but from another terminal.
0
votes
0answers
24 views

How to query mssql db from bash on subsystem for unix

I have a script that is used to query a database and use the result set for further processing. This is a shell script that runs on bash. But the bash used is the one shipped in subsystem for Unix for ...
0
votes
1answer
27 views

Run a command on every file in a directory, changing the output name

I need to compile all of the C files in a directory into seperate outputs... see example gcc -Wall program1.c -o program1.out How do I do this?
0
votes
0answers
64 views

-bash: java: command not found MacOS 10.7.5

I recently "uninstalled" Java 7 because it isn't compatible with Chrome, following the instructions on this site: https://www.java.com/en/download/help/mac_uninstall_java.xml. Then I re-enabled Java ...
0
votes
2answers
24 views

Piping Several commands in a BASH shell

I am trying to recursively loop through a directory which contains numerous other directories and files and then find all the .rb files and copy them to another directory. This is what I have so far ...
0
votes
0answers
35 views

Bash Script Display Remote Screen Session to User

I'm kind of new to bash scripting and I'm having trouble figuring out how to accomplish this. I'm working on a script that is designed to backup and manage a java application that runs within a ...
0
votes
1answer
44 views

Do I have to manually update my PATH in Cygwin shells?

I use Cygwin on Windows 7. I'm not really a Windows user, so it's already a little inconvenient for me to have to have this extra layer in between my OS and Zsh, my shell of choice. Now, I frequently ...
0
votes
1answer
27 views

Naming of custom bash functions [closed]

I recently decided to get into making my own bash functions and started with two easy ones hex2dec and dec2hex but the names of these are not unique enough. Like for dec2hex, it won't autocomplete ...
3
votes
4answers
157 views

Terminal: prefix previous command?

Frequently in Terminal (though I fully expect any answer will work in bash and most others), I type some command, and then get some sort of permission error due to missing sudo. Okay, so press 'up', ...
0
votes
1answer
67 views

Command Line: Browse to a network path that has spaces and a single quote

I am trying to browse to a network path in dos that has both spaces and a single quote. When I do: net use "\\server\path's name\folder\" I get an error message that error 53 has occurred. Any ...
0
votes
1answer
24 views

Is there a way to eliminate the owner and group from `ls -l`?

I never need to see the owner and group for the files listed with ls -l (actually, ls -laF) and am wondering if there's a way to remove them from the output. So I want to change this: lrwxr-xr-x 1 ...
0
votes
0answers
45 views

Open pwd protected http stream in vlc from Linux CLI

Can anyone please advise me on how to open a pwd protected http stream from CLI in vlc? I checked out the --help and man pages, but they seem to offer only syntax for opening ftp, rmt and smb pwd ...
1
vote
2answers
48 views

bash commands that don't fit on one page - make output scrollable

Probably been answered somewhere, but its difficult to frame the search phrase. I am running a bash terminal window and some commands are too big to fit on the page (e.g. ps -A) I vaguely recall a ...
-4
votes
1answer
60 views

Can someone help to make this script [closed]

Can please someone help me to make script for multi screen command at startup here is what it is cd /home/bhop1/serverfiles screen ./srcds_run -console -game cstrike -tickrate 100 -pingboost 2 +map ...
1
vote
1answer
29 views

How to assigne a variable in windows shell?

In the Windows7 shell I have the following working code to print out the current IP adress: @echo off :: get ipv4 ipconfig | findstr IPv4 | findstr 172 > ipadd.txt :: For statement to find the ...