Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

how to identify if sd command failed? #314

@blueray453

Description

@blueray453

I have tried:

sd "${file}.*\n?" "" "$BATCH_FILE" && echo -e "\033[0;34m$ICON_SUCCESS Lines containing $file removed from $BATCH_FILE\033[0m"

and

if sd "${file}.*\n?" "" "$BATCH_FILE"; then
  echo -e "\033[0;34m$ICON_SUCCESS Lines containing $file removed from $BATCH_FILE\033[0m"
fi

and

sd "${file}.*\n?" "" "$BATCH_FILE"

if [[ $? -eq 0 ]]; then
  echo -e "\033[0;34m$ICON_SUCCESS Lines containing $file removed from $BATCH_FILE\033[0m"
fi

It echoes line even if the command fails.

how to identify if sd command failed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions