I am trying to make a script which counts number of columns for a specific table.
The table name will be user input to the script
Code: Select all
#!/bin/ksh
tab_nm=$1
var=`vsql -At -h xxx.xxx.xx -d xxxxx -U xxx -v table_name='$1' -c "select count(column_name) from columns where table_name = ':table_name' group by table_name;"`
echo $var
I am not understanding how to substitiute the variable ':table_name' with the user input value.
Can anybody help me with this.