#!/bin/bash # # list the fields of a specific node type # # # # Usage: # ./get-fields.sh [drupal] [entity type] [entity name] # # # # Example: # ./get-fields.sh klimatologia4 node edition # # Result: # body text_with_summary # field_author string # field_file file # IFS=$'\n' SITE_DIR=$1 TYPE=$2 NAME=$3 [ ! -d ${SITE_DIR} ] && echo "Cannot find directory ${SITE_DIR}" && exit 1 cd $SITE_DIR for FIELD in $(vendor/drush/drush/drush --fields="Field name","Field type" fi ${TYPE} ${NAME} | tail -n +3 | grep -v '\-\-\-'); do NAME=$(echo $FIELD | awk '{print $1}') TYPE=$(echo $FIELD | awk '{print $2}') echo "$NAME $TYPE" done