When I create a Automator action in XCode using Bash, all files and folder paths are printed to stdin.
How do I get the content of those files?
Whatever I try, I only get the filename in the output.
If I just select "Run shell script" I can select if I want everything to stdin or as arguments. Can this be done for an XCode project to?
...
I've tried parsing a list of users currently connected via SSH to a server, but the results are very irregular, so I was forced to simply do:
$users = shell_exec('who');
echo "<pre>$users</pre>";
Is there a better way to parse the output of who in the command line before I let PHP mess around with it? I want it in an array which conta...
I'm writing a simple program to run through a bunch of files in various directories on my system. It basically involves opening them up and checking for valid XML. One of the options of this program is to list bad xml files.
This leads me to my question. What the best output to format this for use with XARGS. I thought putting each ...
I want to set an alias like so:
alias hi='TEST=ok echo $TEST'
However, it doesn't seem to work reliably.
I start with:
unalias hi
unset TEST
Then:
$ alias hi="TEST=ok echo $TEST"
$ hi
$
This is on MacOSX:
$ bash --version
GNU bash, version 3.2.17(1)-release (i386-apple-darwin9.0)
Copyright (C) 2005 Free Software Foundatio...
I know there are a lot of things like this around, but either they don't work recursively or they are huge.
This is what I got:
find . -name "*.so" -exec mv {} `echo {} | sed s/.so/.dylib/` \;
When I just run the find part it gives me a list of files. When I run the sed part it replaces any .so with .dylib. When I run them together t...
Hi,
In a bash script, I would like to put the following code that assigns values to each element of several arrays into a function
for (( i=0 ; i < ${#themes[@]} ; i+=1 )); do
c_bit_mins[i]=-5
c_bit_maxs[i]=15
gamma_bit_mins[i]=-15
gamma_bit_maxs[i]=3
done
i.e. something like
function set_values()
{
for (( i=0 ; i ...
i have the following alias set in my .bashrc:
alias la='ls -laG'
but i would really like to issue a command thusly:
la foo/bar
i guess i have to write a shell script? or is there some xargs way?
...
Hi,
I would like to check if a string begins with "node" e.g. "node001". Something like
if [ $HOST == user* ]
then
echo yes
fi
How can I do it correctly?
Thanks!
UPDATE:
Thank you so much! I further need to combine expressions to check if HOST is either "user1" or begins with "node"
if [ [[ $HOST == user1 ]] -o [[ $HO...
I have hundreds of text files in a folder named using this kind of naming convention:
Bandname1 - song1.txt
Bandname1 - song2.txt
Bandname2 - song1.txt
Bandname2 - song2.txt
Bandname2 - song3.txt
Bandname3 - song1.txt
..etc.
I would like to create folders for different bands and move according text files into these folders. How could ...
I want to redirect FULL output of my program to a file (including Exceptions) in bash. I can't change content of class. I run it like that:
java -Djava.security.manager -Djava.security.policy=JLPPolicy -Xmx16M -Xms2M -cp /var/tomcat/bin/ Main > File
Exceptions are send to console, which is bad for me. Can I do something with it?
...
When using the find command, why is it that the following will successfully ignore hidden directories (those starting with a period) while matching everything else:
find . -not \( -type d -name ".?*" -prune \)
but this will not match anything at all:
find . -not \( -type d -name ".*" -prune \)
The only difference is the question mark...
I feel silly asking this...
I am not an expert on shell scripting, but I am finally in enough of a sysadmin role that I want to do this correctly.
I have a production server that hosts a webapp. Here is my routine.
1 - ssh to server
2 - cd django_src/django_apps/team_proj
3 - svn update
4 - sudo /etc/init.d/apache2 restart
5 - logout
...
Hello,when using something like trap func_trap INT TERM EXIT with
func_trap () {
...some commands...
}
is there a way in the function block to detect which trap has called it?
Something like
func_trap () {
if signal = INT
then do this
else do that
fi
}
Or do I need to write a seperate function for each trap typ...
i have bash script such as
for i in `echo a [ matched.lines`
do
echo $i
done
why output of this script below
a
[
matched.lines
i want output text as it is
a [ matched.lines
how can i do that
thanks for help
...
I have script like:
#!/bin/bash
echo Hellow world!
and I don't know how to call in terminal.
...
I'm playing around with get_iplayer (fantastic) it's running every few hours to grab any new episodes of whatever....
After it has finished grabbing anything new i'd like to change the emblem of ~/Videos to add a plus or star (nautilus emblem preferably)
Do i go about this via nautilus?
Do i need to change something in gnome-config?
I'...
lets say we were to use standard bash terminology to write a for loop which loops srm to securely erase a item on your drive.
Now lets say we set it to iterate 10 times, after it is done the first iteration, How can it still work on the file? The file should no longer exist, so how can It erase it? Not a question specific to srm, anyt...
Whats an easy way to convert 00:20:40.28 to seconds with a bash script? (Split seconds can be cut out, it’s not essential.)
...
I'm not a scripting expert and I was wondering what was an acceptable way to run a script for at most x milliseconds (and yet finish before x milliseconds if the script is done before the timeout).
I solved that problem using Bash in a way that I think is very hacky and I wonder if there's a better way to do it.
Basically I've got on...
I am trying to run this script which changes my desktops background to a random picture in a directory. It works from the command line, and the cronjob gets run (added output and it gets spit out to a log file), but I can't get it to change my background. Here's my current line (set to run every minute for testing).
01 * * * * username ...