ls command >> Syntax Error.

1 回表示 (過去 30 日間)
ckoolschijn
ckoolschijn 2013 年 8 月 20 日
コメント済み: JYOTI CHAHAL 2022 年 4 月 21 日
Hi all,
I'm experiencing some problems with ls command. after typing ls in MatlabR2013a, I get the contents, but this is preceded by: >> ls set: Syntax Error.
Though everything is displayed well, I find it quite annoying. Any ideas what may cause this?
OS: Mac OSX 10.7.5
terminal usage doesn't give this error. location ls: /bin/ls
Best, Cédric
  5 件のコメント
Laurent
Laurent 2013 年 8 月 21 日
The matlab function ls.m should call the unix 'ls' command on Mac OS X. Just as a test, what happens when you type for example 'ls -a' in Matlab? Does that work?
JYOTI CHAHAL
JYOTI CHAHAL 2022 年 4 月 21 日
after typing ls -a the output is "-a not found"

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 8 月 21 日
Check your ~/.bashrc /etc/profile ~/.bash_profile ~/.bash_login and ~/.profile and also any file named by the shell environment variable ENV .
A common error in shell initialization scripts is to use something similar to
set $((tset))
or
stty `tset -q`
(except there would be some option flags involved) to try to set the "terminal type". The "terminal type" is not defined except for interactive login shells. People tend to construct the above initialization files as if they are being executed in that context, but the assumption is not always true. Anything in the shell initialization that depends upon it being an interactive login shell, should be protected with a specific test that a terminal is really available. In the sh / ksh / bash family that can be done with
if -t 0
such as
if -t 0
stty `tset -q`
fi
  5 件のコメント
Walter Roberson
Walter Roberson 2013 年 8 月 27 日
編集済み: Walter Roberson 2013 年 8 月 27 日
Read the source for ls.m . You will see that on unix systems it does a unix() call to use the system's ls.
Question: have you set up a shell 'alias' for ls ? e.g.,
alias ls 'ls -C'
?
ckoolschijn
ckoolschijn 2013 年 8 月 28 日
You're right, it does call the unix() ls.
no aliases are set in my .bash files of .alias. However, I solved the problem, there as I previously also used tcsh shells, there was also a .tcsh file in which some set variables were defined (yet no ls), after moving it to .tcsh.bak, the syntax error is gone. Many thanks for your help! Cheers

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by