英文:
In Ubuntu command ls -l with jc of kellyjonbrazil dosn´t work correct
问题
I try to convert the ls -l command with jc (from js) in a json-object.
ls -l | jc --ls -p
Unfortunate I get this output:

But according to docs from Developer (docs the output must be something líke that.
$ ls -l /usr/bin | jc --ls -p -r
[
  {
    "filename": "apropos",
    "link_to": "whatis",
    "flags": "lrwxrwxrwx.",
    "links": "1",
    "owner": "root",
    "group": "root",
    "size": "6",
    "date": "Aug 15 10:53"
  },
  {
    "filename": "arch",
    "flags": "-rwxr-xr-x.",
    "links": "1",
    "owner": "root",
    "group": "root",
    "size": "33080",
    "date": "Aug 19 23:25"
  },
  ...
]
I exoected this output with this command:
$ ls -l /usr/bin | jc --ls -p -r
[
  {
    "filename": "apropos",
    "link_to": "whatis",
    "flags": "lrwxrwxrwx.",
    "links": "1",
    "owner": "root",
    "group": "root",
    "size": "6",
    "date": "Aug 15 10:53"
  },
  {
    "filename": "arch",
    "flags": "-rwxr-xr-x.",
    "links": "1",
    "owner": "root",
    "group": "root",
    "size": "33080",
    "date": "Aug 19 23:25"
  },
  ...
]
Have anybody a idea or experience?
I thank you in advance
Andrej
英文:
I try to convert the ls -l command with jc (from js) in a json-object.
ls -l | jc --ls -p
Unfortunate I get this output:

But according to docs from Developer (docs the output must be something líke that.
$ ls -l /usr/bin | jc --ls -p -r
[
  {
    "filename": "apropos",
    "link_to": "whatis",
    "flags": "lrwxrwxrwx.",
    "links": "1",
    "owner": "root",
    "group": "root",
    "size": "6",
    "date": "Aug 15 10:53"
  },
  {
    "filename": "arch",
    "flags": "-rwxr-xr-x.",
    "links": "1",
    "owner": "root",
    "group": "root",
    "size": "33080",
    "date": "Aug 19 23:25"
  },
  ...
]
I exoected this output with this command:
$ ls -l /usr/bin | jc --ls -p -r
[
  {
    "filename": "apropos",
    "link_to": "whatis",
    "flags": "lrwxrwxrwx.",
    "links": "1",
    "owner": "root",
    "group": "root",
    "size": "6",
    "date": "Aug 15 10:53"
  },
  {
    "filename": "arch",
    "flags": "-rwxr-xr-x.",
    "links": "1",
    "owner": "root",
    "group": "root",
    "size": "33080",
    "date": "Aug 19 23:25"
  },
  ...
]
Have anybody a idea or experience?
I thank you in advance
Andrej
答案1
得分: 1
只返回翻译好的部分:
可能该工具仅处理ls的非本地化输出。尝试使用C区域设置运行它:
LC_ALL=C ls - l | jc --ls -p
英文:
It's possible the tool only handles non-localised output of ls. Try running it with the C locale:
LC_ALL=C ls - l | jc --ls -p
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论