Share your shell scripts

NeXT Computer, Inc. -> NEXTSTEP / OPENSTEP Software

Title: Share your shell scripts
Post by: pTeK on February 02, 2024, 05:20:33 PM
Share your shell scripts here in this thread please, I'll keep updating this post :)
Title: findq find filename in the system
Post by: pTeK on February 02, 2024, 05:27:18 PM
findq find filename in the system.
I call it findq as it saves me remembering and typing the whole command line, I use this on NS33

#!/bin/sh
# Check if the correct number of arguments is provide
if [ $# -ne 2 ]; then
  echo "Usage: $0 file_to_find directory"
  exit 1
fi

/usr/bin/find $2 -name "$1" -print

strinq find a string in a file and print the directory (need to add line # and offset), NS33
#!/bin/sh

#check if the correct number of arguments is provided
if [ $# -ne 2 ]; then
  echo "Usage: $0 string [directory]"
  exit 1
fi

string=$1
direc=$2

/usr/bin/find $direc -type f -name "*" -exec grep -l -i "$string" '{}' \; -print

Go to top  Forum index