0

I wrote a shell script which uses awk command in it.

It used to work before as expected. It stopped working very recently and throwing awk command not found error when running the script

#!/bin/bash

SRCDIR="/home/ubuntu/imdb/src"
DATADIR="/home/ubuntu/imdb/data"
PATH="/home/ubuntu/imdb/data/tmp"

split_cst_data()
{
    echo "krishna"
    data=`awk 'END {print NR}' $DATADIR/data_cst_name_basics.tsv`
    echo $data
    #l_upto=$((data / 100)
    #split -l$l_upto data_cst_name_basics.tsv $PATH/split_file_
    
}
split_cst_data

Here's the error I'm getting:

krishna

./test_imdb_cst.sh: line 12: awk: command not found

Community
  • 1
  • 1
Underoos
  • 4,708
  • 8
  • 42
  • 85
  • 3
    I was messing with *PATH* variable which I realised later. It worked after renaming it. – Underoos Apr 18 '19 at 09:21
  • 1
    This is why you should stick to lower- and mixed-case variable names. `PATH` is a common mistake, but there are too many all-caps names with special meaning to keep track of them all. – Gordon Davisson Apr 18 '19 at 19:08

0 Answers0