I have below lines in unix script;
list_table_name=`hive -e 'show tables from schema'| grep -i 'hst_*' |sort -r|head -1`
When executing the script order of the commands is getting changed.
Sometimes the order is coming as
hive -e 'show tables from schema'
grep -i 'hst_*'
sort -r
head -1
but sometimes the order is coming as
hive -e 'show tables from schema'
sort -r
head -1
grep -i 'hst_*'
Why this is happening?
hive
beforegrep
? – berndbausch Jul 21 '21 at 08:47ps
) notices them in a random order. The actual data flow is always correct because the pipes are created and fds assigned before the processes are executed. – Paul_Pedant Jul 21 '21 at 08:49list_table_name
) is affected by the order the commands in your pipeline are executed? – fra-san Jul 21 '21 at 09:57list_table_name
contains multiple lines, in spite of thehead -1
in the pipeline? Please, show me an actual command, and its verbatim output, that contains the four lines you list. – Paul_Pedant Jul 21 '21 at 16:49