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

learn more… | top users | synonyms

0
votes
0answers
4 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
0answers
5 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
9 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? ...
0
votes
0answers
6 views

cURL form parameters: read contents from file and set type

I'm trying to perform a PUT as follows curl -X PUT \ -H "Content-Type:multipart/form-data" \ -F "JSON_Param=<file.txt;type:application/json" \ -L "$MY_URL" where file.txt contains ...
1
vote
1answer
21 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
-1
votes
0answers
19 views

Why Ii obtain this error when I try to compile and install a software on Ubuntu 14.04?

I am not yet a Linux guy and I am going crazy trying to install a software compiling it on Ubuntu 14.04. This are the only provided instruction to install it: Debian First, make sure that ...
0
votes
0answers
20 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
26 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
22 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
33 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
24 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
9 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
7 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
22 views

Using /usr/bin/env to change directory [on hold]

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
31 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
30 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
18 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
8 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
25 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
13 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
15 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
24 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
16 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
20 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
137 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
33 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
23 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
16 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
38 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
49 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
28 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 ...
2
votes
2answers
63 views

How can I execute a command and immediately quit the terminal?

It should be pretty clear what I'm trying to do: original script.sh: select blah in foo bar oof rab do cmd $blah break done Pretty basic stuff. The problem arises when I try the following: ...
1
vote
1answer
13 views

/dev/dsp missing in debian and cannot hear festival utterance

Tried to make an utterance in festival and it seems /dev/dsp/ is missing in the debian. How to add this? festival> (SayText "Hello") Linux: can't open /dev/dsp #<Utterance 0xb669c708>
0
votes
1answer
23 views

How to apply “set number” to vi on root?

I'm using vi on centos 6.5 and added "set number" script to /etc/bashrc in order to look line numbers whenever boot. It works well to show it on user login but not root. How to apply "set number" of ...
2
votes
2answers
46 views

sed error when launching terminal on OS X

I get these error messages when launching bash or zsh in standard Terminal.app or iTerm2 sed: 1: "\#^system_type=# { s#^s ...": extra characters at the end of p command sed: 1: "\#^system_type=# { ...
0
votes
2answers
17 views

Bash prompt coloring not appearing correctly

I had a functioning Bash prompt colored how I wanted it, but after reinstalling the background is gray rather than black like this setting should make it. My PS1 is \[\e[33;40m\]\T ...
1
vote
2answers
26 views

How to exclude a file from a command with ZSH?

Given this directory content : one.file two.file three.file in bash, when I enter rm *.file !(two) only one.file and three.file are deleted. How can I do this in ZSH?
0
votes
1answer
21 views

Calling a list of functions provided on a stream

I'm writing a bash script to configure a server in which the end user will have to choose the actions to perform and the script will execute them. Each action will be implemented as a function. I've ...
0
votes
1answer
22 views

.bashrc used in gnome not just terminal

I've recently started using the Anaconda Python distribution for software development and I want it to be the default Python distribution when I run something in the terminal. In order to do this, ...
-1
votes
1answer
22 views

how to escape '$' in an awk statement in shell alias

I'm trying to write an alias that will kill all running php processes.. this is the command i got in my ~/.bash_profile alias killphp="ps aux | g [p]hp | awk '{print $3}' | xargs kill -9" this ...
0
votes
0answers
6 views

How to run an script using cron in Windows 7 using cygwin?

I have installed all the dependencies in cron. My scripts are working properly, and also I have tested cron which I think works properly as well. However, I would like to set up a task to run a script ...
2
votes
2answers
28 views

Discard content of logfile, keeping tail

I'm looking for a way how to discard content of the logfile, leaving only defined tail. In two steps it's quite easy: tail -n1000 alert_migtst.log > alert_migtst.tail mv -f alert_migtst.tail ...
0
votes
1answer
33 views

How can I do a recursive find and replace from the command shell?

Using a shell like bash or zshell, how can I do a recursive 'find and replace'? In other words, I want to replace every occurrence of '/path/to/folder' with '/other/dir' in all files in this directory ...
1
vote
2answers
30 views

Relative bash colors that work with all schemes?

How can I have a "relative" color in bash, rather than hardcoded one? If I specify to use yellow "\033[93m" then it looks bad for those people that use white background. Is there a way to specify not ...
1
vote
2answers
39 views

grep to display all IPs in a text file (linux)

I'm writing a script to look for a ping from a certian foreign IP, but I am having some trouble understanding how to format my "grep" command.. Inside my text file is the output from "netstat anp" ...
0
votes
1answer
28 views

end child process on network timeout

I have a .NET program (Edit: using MONO), call it myfoo that resides on my remote ubuntu server. To access it, I ssh into my box (using wifi, not ethernet). My bash shell starts up as normal, I cd ...
1
vote
2answers
34 views

SSH TERM detection

My ssh config file has accept env set as: AcceptEnv LANG LC_* I am a bit confused how when I ssh through some clients my TERM variable is set as xterm256-color, and other clients TERM is set as ...
1
vote
1answer
33 views

How to find out process that uses file but is not using at the moment?

Background I, as well as many other people according to Apple's support forums, am having some trouble with the audio settings on my Mac. Whenever the computer sleeps or powers off, the audio resets ...
3
votes
0answers
454 views

Unix: “ls” command shows files with ? after the extension [migrated]

I have written a shell script (test.sh) using Java. This shell script actually does a copy job from one file to the other. After the execution of the shell script I have opened the directory from ...
1
vote
1answer
34 views

Bash: Read file that contains a star (*)

I'm to read the contents of a file in a variable. Doing the following is great: content1=$(<content-1.html) However, if that file contains a star (*), instead of reading it properly, it replaces ...