dev/endpoints/get-fields.sh
2024-02-19 15:19:03 +02:00

33 lines
556 B
Bash
Executable File

#!/bin/bash
#
# example:
#
# ./get-fields.sh klimatologia4 node edition
#
# body text_with_summary
# field_author string
# field_file file
#
IFS=$'\n'
DIR=$1
TYPE=$2
NAME=$3
cd /var/www/sites/$DIR
for FIELD in $(vendor/drush/drush/drush fi ${TYPE} ${NAME} | tail -n +3 | grep -v '\-\-\-'); do
NAME=$(echo $FIELD | awk '{print $1}')
TYPE=$(echo $FIELD | awk '{print $2}')
COUNT=$(echo $TYPE | wc -c)
THIRD=$(echo $FIELD | awk '{print $3}')
if [ "$COUNT" -lt 5 ] && [ -z "${SECOND// }" ]; then
TYPE=$THIRD
fi
echo "$NAME $TYPE"
done