Tagged: sh

Using a Colon As A Bash Null Operator


references

The title of this entry is came from the referent entry.
본 entry의 제목은 위에 언급된 페이지의 것을 사용하였음을 밝힌다.

:

shellscript를 하나 만들 던 중 if 구문에서 thenelse 사이에 아무것도 하고싶지 않을 때 : 을 사용하면 되는 것을 배웠다.

if <condition>; then
    # todo...
    :
else
    echo i'm in else
fi

find all jar files and print


I thought I need to print some jar files’ entries in my Java ME SDK’s lib directory.

$ zipinfo -1 cldc_1.8.jar
META-INF/
...
java/util/logging/StreamHandler.class
$

Then I tried to store those output to a text file.

$ zipinfo -1 cldc_1.8.jar > cldc_1.8.jar.txt
$ cat cldc_1.8.jar.txt
META-INF/
...
java/util/logging/StreamHandler.class
$

Then I need to change line delimiters for Windows..

$ unix2dos.exe cldc_1.8.jar.txt
unix2dos: converting file cldc_1.8.jar.txt to DOS format...
$

I realized I can do this in one command.

$ zipinfo -1 cldc_1.8.jar | unix2dos > cldc_1.8.jar.txt
$

And, finally, I can print all jar files entries in a command.

$ for j in *.jar;do zipinfo -1 $j | unix2dos > $j.txt;done
$