次の冗長性を減らすにはどうすればよいですか?つまり、2つのほぼ同一のステートメントを1つに結合する方法はありますか?
FULFILLMENT="/Users/david/Desktop/pds" # "/Volumes/FulfilmentArray/"
ARCH1="/Users/david/Desktop/etc" # "/Volumes/Arch_01/"
FILE="/tmp/files.txt"
# find all the paths and print them to a file
sudo find $FULFILLMENT -ls | python -c '
import sys
for line in sys.stdin:
r = line.strip("\n").split(None, 10)
fn = r.pop()
print ",".join(r) + ",\"" + fn.replace("\"", "\"\"") + "\""
' > $FILE &&
sudo find $ARCH1 -ls | python -c '
import sys
for line in sys.stdin:
r = line.strip("\n").split(None, 10)
fn = r.pop()
print ",".join(r) + ",\"" + fn.replace("\"", "\"\"") + "\""
' >> $FILE