Hi
Can you please tell me what is wrong with this line:
if [ [ "${x}" = "12" ] && [ ! "$F" =~ \.g$ ]]; then
basically i want to check if x = 12 and F (Filename) end with 'g'. But it is throwing syntax error.
Hi
Can you please tell me what is wrong with this line:
if [ [ "${x}" = "12" ] && [ ! "$F" =~ \.g$ ]]; then
basically i want to check if x = 12 and F (Filename) end with 'g'. But it is throwing syntax error.
Drop the first square bracket and add one to the second test.
You mean to say like this : if [ "${ptype}" = "sql" && [[ ! "$F" =~ \.sql$ ]]]; then
but this line also gives error
syntax error in conditional expression
syntax error near `;'
if [ "${ptype}" = "sql" && [[ ! "$F" =~ \.sql$ ]]]; then'
if [ "${ptype}" = "sql" ] && [[ ! "$F" =~ \.sql$ ]]; then
if [ ${x} -eq 12 ] && [ $(echo "$f" | grep -Ec ".sql$") -eq 0 ];
In this way the test is true only if ptype="sql" and F ends with "sql":
if [[ "${ptype}" = "sql" ]] && [[ "$F" =~ \.sql$ ]]; then
It worked . Thank You
if [[ "$x" -eq 12 && "$F" =~ p$ ]]; then