I've been trying to write a shell script to travel a directory tree and play every mp3 file it finds. afplay is my utility of choice, given that I am on a mac. However, afplay only takes one argument at a time, so you have to call it over and over again if you want it to keep playing. It seems like the simplest solution would be as follo...
How do you exclude a folder when performing file operations i.e. cp etc.
I would currently use the wild card * to apply file operation to all, but I need to exclude one single folder.
The command I'm actually wanting to use is chown to change the owner of all the files in a directory but I need to exclude one sub directory.
...
I have a bash script I'm writing that greps for a filepath. I want to be able to use the output of the grep to replace each instance of the old filepath with the new filepath.
Example:
grep -R "/~test/dev/portal" .
I want to be able to pipe this output into sed to replace each instance of "/~test/dev/portal/" with "/apps/portal/" (k...
I want a quick way to open the last modified file in the directory, perhaps in a form of alias.
Currently, I do ls -ltr. Then copy-and-paste the filename
Assume that I am using tcsh
...
Hi I have dozens of XML files with
I would need this:
<p begin="00:06:28;12" end="00:00:02;26">
translated into this:
<p begin="628.12" end="631.08">
I know i need a simple awk or sed to do this, but being new; can someone help
...
Assume someuser has a home directory /home/someuser
NAME=someuser
In bash - what expression to I use combining tilde (~) and $NAME to return the users home directory?
HOMEDIRECTORY=~someuser
echo $HOMEDIRECTORY
/home/someuser
NAME=someuser
echo ~$NAME
~someuser
any suggestions?
...
I'm trying to write a monitoring script. It should connect to some port on my server. Read the output. If the output is the expected value, print 1, otherwise print 0. I'm working on a solution involving cat < /dev/tcp/hostname/port, but the solution eludes me. Maybe something involving expect? Prefer a bash script solution. Help appreci...
#!/bin/bash -x
echo "Enter file name: "
read fileName
fileName=`pwd`"/$fileName"
if [ -f $fileName ]; then
echo "file is present"
fi
Even if I change the value of fileName by adding quotes at starting and end.. The script still doesnt work.
...
I'm trying to figure this out on and off for some time now. I have a bash script in Linux environment that, for safety reasons, I want to prevent from being executed say between 9am and 5pm unless a flag is given. So if I do ./script.sh between 9am and 5pm it would say "NO GO", but if I do ./script.sh -force it would bypass the check. Ba...
There are a ton of ways to integrate Cygwin with Emacs on Windows. EmacsWiki shows a few ideas. Here are the options that I've found:
Use the Emacs that comes with Cygwin. (Then find a way to get to cmd.exe if you want it.)
Use NTEmacs and Cygwin as a "sometimes" shell. (A special command to launch Cygwin)
Use NTEmacs and Cygwin as...
I have a regex and replacement pattern that have both been tested in Notepad++ on my input data and work correctly. When I put them into a sed expression, however, nothing gets matched.
Here is the sed command:
# SEARCH = ([a-zA-Z0-9.]+) [0-9] (.*)
# REPLACE = \2 (\1)
sed -e 's/\([a-zA-Z0-9.]+\) [0-9] \(.*\)/\2 \(\1\)/g'
Here is...
I have very little experience with AWK, but it seems like the best tool for my purpose now.
I am trying to get a list of nearby BSSIDs by using the airport -s command in OS X. Output looks like this:
SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
MyWireless 00:11:22:33:44:55 -85 64 ...
Hi,
I'm having a hard time figuring out how to do this if statement. I want to do this:
IF (the function has only 1 argument
AND $1 is a directory (in the current
folder)) OR IF (the function has 2
arguments AND $1 is NOT a directory ) THEN
....
END
Sorry if it's not very clear,
Thanks in advance
...
Hi again,
I'm not sure if it is possible but what I want to do is to run a bash command and storing the output in a variable AND display it as if I launched the command normally. Here is my code:
VAR=`svn checkout $URL`
So I want to store the output in VAR and still see the result (and because svn checkout takes a long time, I can't ...
Basically I'm trying to copy the contents of both dir1 and dir2 (excluding subdirectories) into dir3. The caveat is that if a file exists in both dir1 and dir2, I need to copy the newer file. Lets say the newer file exists in dir2.
I had:
find dir1 -type f -exec cp {} dir3 \;
find dir2 -type f -exec cp -u {} dir3 \;
Doing it this way...
Ok, I can't figure this out from reading Perl's documentation. I'm looking at the RHEL4 init script for Apache... What does this line of code do?
httpd=${HTTPD-/usr/sbin/httpd}
Why not just httpd=/usr/sbin/httpd? What's up with all the extra syntax?
-Geoffrey Lee
...
I want to create a shellscript that reads files from a .diz file, where information about various source files are stored, that are needed to compile a certain piece of software (imagemagick in this case). i am using Mac OSX Leopard 10.5 for this examples.
Basically i want to have an easy way to maintain these .diz files that hold the ...
Hi sorry for asking simple shell question again but my TA in school doesnt check the school forum so I never get any answer, please help me again, thanks
anyways:
I am trying to use array to store a list of file names using the Find command, but for some reason the array fail to work in the bash used by the school, my program works on ...
http://bash.cyberciti.biz/file-management/shell-script-to-simulate-unix-more-command/
#!/bin/bash
# Write a shell script like a more command. It asks the user name, the
# name of the file on command prompt and displays only the 15 lines of
# the file at a time.
# -------------------------------------------------------------------------
...
i wanted to create some shellscripts that display pretty ansi colored graphics for osx but unfortunately i find just very little information about that topic.
osx seems to use monaco 10 as its default console font. is there some way to find out all displayable characters for this font?
osx terminal runs in UTF-8 per default as far as i...