PAGER ('/ dev / null'): разрешение отклонено

516
vhnd

Установка PAGER в /dev/nullсоответствии с предложением через сеть для предотвращения печати каждой команды в stdout приводит к ошибке в OS X 10.6:

octave:1> PAGER('/dev/null'); octave:2> 1 sh: /dev/null: Permission denied 

Есть ли способ это исправить?

-1
На что вам стоит обратить внимание в первую очередь? Разрешения / dev / null. Кто они такие? Из этого вы должны быть в состоянии выяснить вашу проблему. mdpc 10 лет назад 1
да, как если бы вы попытались chmod + x / dev / null самостоятельно, и это сработало vhnd 10 лет назад 0

2 ответа на вопрос

1
grawity

The error message is shown because Octave is expecting PAGER to be set to a program that can be run and given the text as 'stdin'. The /dev/null file is obviously not a program, and it does not have the "executable" permission bot; the latter is what causes the permission error.

Try /usr/bin/cat or /usr/bin/true instead.

0
vhnd

Like grawity said above, Octave is indeed expecting PAGER to be set to a program, but cat raises an error, true raises a broken pipe warning.

So, figured Octave was just piping output to PAGER, and fixed this by redirecting the output of a valid program to /dev/null:

PAGER('less > /dev/null') PAGER('true > /dev/null')