Guest User

Untitled

a guest
Mar 5th, 2025
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. change() {
  2. from=${1}
  3. shift
  4. while [ $# -gt 0 ]; do
  5. case ${1} in
  6. "to")
  7. shift
  8. to=${1} ;;
  9. "in")
  10. shift
  11. file=${1} ;;
  12. esac
  13. shift
  14. done
  15.  
  16. if [ -n $from -a -n $file ]; then
  17. eval "sed -i 's%${from}%${to}%g' $file"
  18. else
  19. stop "poorly formed change statement"
  20. fi
  21. }
Advertisement
Add Comment
Please, Sign In to add comment