Skip to main content
Added more info
Source Link
heemayl
  • 58.1k
  • 9
  • 129
  • 144

You can use Here Strings. It is supported by bash, zsh and other common shells.

Example: The grep command only work with files but here we are passing a variable using Here Strings to be searched for pattern by grep.

$ str="this is a test line"
$ grep -o "test" <<< "$str"
test

As far as your command is concerned you can use:

$ base64 <<< "$str"

You can use Here Strings. It is supported by bash, zsh and other common shells.

Example:

$ str="this is a test line"
$ grep -o "test" <<< "$str"
test

You can use Here Strings. It is supported by bash, zsh and other common shells.

Example: The grep command only work with files but here we are passing a variable using Here Strings to be searched for pattern by grep.

$ str="this is a test line"
$ grep -o "test" <<< "$str"
test

As far as your command is concerned you can use:

$ base64 <<< "$str"
Source Link
heemayl
  • 58.1k
  • 9
  • 129
  • 144

You can use Here Strings. It is supported by bash, zsh and other common shells.

Example:

$ str="this is a test line"
$ grep -o "test" <<< "$str"
test