I've been experiencing a strange issue the last couple of days while writing a shell script which executes Java (starting the JBoss AS). I have a variable JAVA_OPTS that I am creating, and finally passing to the 'java' command. When I hard code the values in JAVA_OPTS rather than using variable expansion, the java process executes normal...
I got binary file, that contains doubles. How do i print that out to a terminal.
I've tried octaldump 'od' but cant figure out the syntax I've tried something like
head -c80 |od -f
But that doesnt work, the man page for od is extremely bad.
I've made a c program that does what I want,
something like assuming 10double chunks.
double...
I'm trying to do some fairly simple string parsing in bash script.
Basically, I have a file that is comprised of multiple multi-line fields. Each field is surrounded by a known header and footer.
I want to extract each field separately into an array or similar, like this
>FILE=`cat file`
>REGEX="@#@#@#[\s\S]+?@#@#@"
>
>if [[$FILE =~ ...
Hi,
I need to write a bash script that will iterate through the contents of a directory (including subdirectories) and perform the following replacements:
replace 'foo' in any file names with 'bar'
replace 'foo' in the contents of any files with 'bar'
So far all I've got is
find . -name '*' -exec {} \;
:-)
...
I have an "alarm email" function inside a python module. I want to be able to call this function from a bash script. I know you can call a module using 'python ' in the script, but I'm not if you can or how you would call a specific function within the module.
...
I have a .bash_profile script and I can't get the following to work
alias lsls='ls -l | sort -n +4'
when I type the alias lsls
it does the sort but then posts this error message
"-bash: +4: command not found"
How do I get the alias to work with '+4'?
It works when type ls -l | sort -n +4 in the command line
I'm in OS X 10.4
Than...
metadataPattern
The pattern used to extract metadata from a file name if metadata does not exist
or useMetadata == 0.
default is /%N. for unix and \%N. for windows
%N = song name
%G = genre
%A = album
%R = artist
%Y = four digit year
%# = sequence of digits
%% = % character
[] = brackets option...
Hi,
I have a Vista share visible in Ubuntu but I which to make the BASH color highlighting of the directories/files the same as if it were a local dir/file. How would I go about doing this?
Many thanks!
...
This is just driving me nuts. I am trying to read a file in bash, remove duplicates, sort, and then display a "list choice" window via applescript.
My $DATALOG file is formatted like this:
field1 field2
field1 field3
field1 field4
etc...
Applescript=awk '{print $2}' $DATALOG | awk ' !x[$0]++' | sort -u | tr "_" " "| sed 's/^/\"/'...
Hi
I am trying to output 'awk' result to file in my script, with no success.
Using '>' does not work, why?
for a in $(find $OUPUT_DIR/ -maxdepth 1 -mindepth 1 -type d -printf "%P\n")
do
echo $a is a directory
awk -F, '{ if ($10 == '"$a"') print $0 }' $OUPUT_DIR/CDRNOutput_${CDR_DATE}.csv > $OUPUT_DIR/$a/CDR-${CDR_DATE}.csv
done...
I have hundreds of files in one folder named like this:
index.html?tab=This is - the file name
I would like to remove "index.html?tab=" part and add extension ".txt" to all files. How can I do this using Unix command line tools (I'm using MacOSX 10.6.2)?
...
Right now this outputs the value I need on stdout. How can I capture it into a variable so I can use it in the rest of the script?
Requirements:
The script needs to be all in one file.
I'd prefer not to write any temp files, if possible.
.
#!/bin/bash
cat << EOF | xsltproc - ../pom.xml | tail -1
<?xml version="1.0"?>
<xsl:stylesh...
If a bash script has set -e, and a command in the script returns an error, how can I do some cleanup before the script exits?
For example:
#!/bin/bash
set -e
mkdir /tmp/foo
# ... do stuff ...
rm -r /tmp/foo
How can I ensure that /tmp/foo is removed, even if one of the commands in ... do stuff ... fails?
...
Hi,
I have a problem while executing a bash script from C++ using the system call command.
The script catch a SIGPIPE signal and exit with ret code 141.
This problem has started to appear only in the last release of my code.
My Questions are as follows:
1) Why does this SIGPIPE occur now and didn't occur before?
2) Is it safe to ignor...
How could I use find unix utility to find all working copies on the machine? For example, I can use find / -name .svn -type d command, but it outputs all redundant results (a lot of subfolders), while I need only parent directory of working copy to be shown.
There is related question, but it does not really help in my case: http://stac...
I want to execute a command like 'git tag -l' inside a directory /home/user/git/app/ but I am actually in /home/user.
How can I do that in bash without changing my working directory?
So NOT:
cd /home/user/git/app && git tag -l
because that actually changes my working directory and have to do 'cd /home/user' again.
...
I normally have several problems with how cron executes scripts as they normally don't have my environment setup. Is there a way to invoke bash(?) in the same way cron does so I could test scripts before installing them?
...
I have a user input that would be used in a search string that may contain a metacharacter
For e.g. C# or C++
my grep command in a function was:
grep -E "$1|$2" test.txt
under direct replacement:
grep -E "C\+\+|testWord" test.txt
grep -E "C\#|testWord" test.txt
the first caught the lines fine but not the second.
Strangely, # was...
I know how to config aliases in bash but is there a way to configure an alias for a sequence of commands?
i.e say I want one command to change to a particular directory, then run another command
In addition, is there a way to setup a command that runs "sudo mycommand" then enters the password? In the MSDOS days I'd be looking for a .bat...
Just witting a simple shell script and little confused:
Here is my script:
% for f in $FILES; do echo "Processing $f file.."; done
The Command:
ls -la | grep bash
produces:
% ls -a | grep bash
.bash_from_cshrc
.bash_history
.bash_profile
.bashrc
When
FILES=".bash*"
I get the same results (different formatting) as ls -a. ...