S
S
Sergey Karbivnichy2020-08-23 19:11:49
linux
Sergey Karbivnichy, 2020-08-23 19:11:49

How to pass many identical parameters to the program in sh script?

While experimenting with Linux, you need to look at what files have changed recently. I wrote a simple script, even seemingly working:

#!/bin/bash
# echo $0
# echo $1
# echo $2
# echo $3

find $1 -mmin $2 -not -path "/dev/*" -not -path "/sys/*" -not -path "/proc/*" -not -path "/home/sergey/.config/google-chrome/*" -not -path "/home/sergey/.cache/google-chrome/*" -not -path "/home/sergey/.cache/mesa_shader_cache/*"  2>/dev/null

But editing it is inconvenient. How to make it so that exclusive paths are added to a column (such as an array, or a variable), and already find pass this array or variable.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-08-23
@hottabxp

Can be used\

find $1 -mmin $2 \
  -not -path "/dev/*" \
  -not -path "/sys/*" \
  -not -path "/proc/*" \
  -not -path "/home/sergey/.config/google-chrome/*" \
  -not -path "/home/sergey/.cache/google-chrome/*" \
  -not -path "/home/sergey/.cache/mesa_shader_cache/*"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question