TransWikia.com

Linux - grep is not working as expected in CircleCI

Unix & Linux Asked on November 21, 2021

My laptop is Mac and CircleCI uses Linux and I have to run shell script in CircleCI like below.

SOME_ERROR_TEXT="some error text verbose verbose"

if yarn schema-codegen | grep "$SOME_ERROR_TEXT"; then
  echo "success!"
  exit 1
else
  echo "failure!"
fi

The result of yarn schmea-codegen contains SOME_EROR_TEXT.

some error text verbose verbose lorem ipsum dfaskldjfskdljfldsakjfkldsjflksdjf
dsflsdjflkjdsfjlkdsjfljdslkfjlkdsjfjdsljfldsjfkjjj
     11123123213123
 '''''

This script is working on my Mac, but it is not working on CircleCI environment. Is there wrong syntax in my script? If not, I will solve this problem on CI. Thanks

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP