Open
Description
https://www.onlinegdb.com/online_bash_shell
bash code
while read -p 'input relations model_name : ' line
do
yo_associate=("${yo_associate[@]}" $line)
done
for i in ${!yo_associate[@]}; do
yo_associate_str+=("
models.${MODEL_NAME}.belongsTo(models.${yo_associate[$i]}, {
foreignKey: '"${yo_associate[$i]}"_id',
constraint: false,
});
")
done
echo '
"
code lain out echo with single quotes //
'${yo_associate_str[@]}'
code lain //
"
'
# beutiful
echo "
code lain out echo with double quotes
'${yo_associate_str[@]}'
code lain
"
output :
input relations model_name : user
input relations model_name : company
input relations model_name :
"
code lain out echo with single quotes //
models..belongsTo(models.user, { foreignKey: 'user_id', constraint: false, }); models..belongsTo(models.company, { foreignKey: 'company_id', constraint: false, });
code lain //
"
code lain out echo with double quotes
'
models..belongsTo(models.user, {
foreignKey: 'user_id',
constraint: false,
});
models..belongsTo(models.company, {
foreignKey: 'company_id',
constraint: false,
});
'
code lain
...Program finished with exit code 0
Press ENTER to exit console.