3

I have written a simple script as below to run deepin-terminal and pass it a simple command but when I execute this script I get error.

Script:

#!/bin/bash

deepin-terminal -m fullscreen -e "cmatrix | lolcat"

Error:

Failed to execute child process “cmatrix | lolcat” (No such file or 
directory)

If I just pass cmatrix command it works but it does not work with cmatrix | lolcat

Kusalananda
  • 320,670
  • 36
  • 633
  • 936
Milad ABC
  • 173
  • 1
  • 7

1 Answers1

2

The -e option for deepin-terminal, as for most terminal emulators, takes a simple command. A pipeline is not a simple command.

The error comes from the terminal trying to execute a command with the literal name cmatrix | lolcat (including spaces and pipe symbol).

Instead, use

deepin-terminal -m fullscreen -e sh -c "cmatrix | lolcat"

This would execute sh with an in-line script, which runs your pipeline.

Kusalananda
  • 320,670
  • 36
  • 633
  • 936
  • Thanks it solved the problem but deepin terminal is not running in fullscreen mode anymore. What about that? – Milad ABC Aug 05 '18 at 08:32
  • 1
    @Miladdarren I'm not familiar with `deepin-terminal` in particular, so I can't really say anything about why it would ignore `-m fullscreen` when combined with `-e`. – Kusalananda Aug 05 '18 at 08:47