Skip to main content
3 of 5
Rollback to Revision 1
xenoid
  • 9.3k
  • 4
  • 29
  • 52

As it says on the tin. You create a command name which is egrep '2019-05-11|Total' and then try to call it. This is not a egrep followed by a parameter but a complete command name. What you want is more likely:

totalSize=$(echo $s3ls| egrep "$currentDate|Total" | awk -F 'Total Size:' '{print $2}'|sed '/^$/d')

If necessary you can use a variable to hold the parameter:

egrepParm="$currentDate|Total" 
totalSize=$(echo $s3ls| egrep "$egrepParm" | awk -F 'Total Size:' '{print $2}'|sed '/^$/d')
xenoid
  • 9.3k
  • 4
  • 29
  • 52