LoginSignup
0
0

More than 5 years have passed since last update.

zsh / c > print -lで取得したコマンドを表示 > print -l ${(ok)functions} ${(ok)commands} / argc, argv[]の使用

Last updated at Posted at 2016-10-21
動作環境
CentOS 6.5
zsh 4.3.11 (x86_64-redhat-linux-gnu)
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)

関連記事

readargc.c
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    int idx;

    for(idx=0; idx < argc; idx++) {
        if (idx==0) {
            continue; // skip command itself
        }
        printf("%s\n", argv[idx]);
    }
}

使い方

コンパイル

$gcc readarg.c -o readarg

実行

$ ./readarg $(print -l ${(ok)functions} ${(ok)commands} )
module
[
a2p
ab
abrt-action-analyze-backtrace
abrt-action-analyze-c
abrt-action-analyze-ccpp-local
abrt-action-analyze-core
中略
yumdb
yum-debug-dump
yum-debug-restore
yumdownloader
yum-groups-manager
zcat
zcmp
zdiff
zdump
zegrep
zenity
zfgrep
zforce
zgrep
zic
zip
zipcloak
zipgrep
zipinfo
zipnote
zipsplit
zless
zmore
znew
zsh
zsoelim
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0