Posted: Sun 19 Apr 2015, 21:42 Post subject:
sh/bash -- find all files with the word java in them
This is my first attempt at a bash or an sh script
for aFile in `find /etc`; do
#echo "Entering $aFile"
for line in `grep '^.*java.*$' -i -x $aFile`; do
if [ $found -eq 0 ]; then
echo "File = $aFile"
#echo "Line = $line"
here is the output:
File = /etc/hosts
grep: /etc/xdg/menus/applications-merged/The: No such file or directory
grep: Free: No such file or directory
grep: Network: No such file or directory
grep: Project.menu: No such file or directory
File = /etc/mime.types
grep: /etc/init.d/binfmt-support: No such file or directory
File = /etc/modprobe.d/puppy.conf
File = /etc/hiawatha/mimetype.conf
File = /etc/gitweb.conf
File = /etc/X11/xkb/symbols/pc/in
File = /etc/services
1. I couldn't figure out how to use the variables true and fase so I used one and zero instead.
2. grep seems to give an error when passed a broken symbolic link. I need a way to suppress this.
If your curious why I wrote the script. I was wondering where the java library search path might be stored. My puppy version is "precise". I recently installed libsvn-java (i.e. javaHL) which is a library required for eclipse to import from a git repository. The puppy package manager installed this at:
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum