This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat /etc/profile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Hello, World!" | |
echo -n "do not output the trailing newline" | |
echo -e "enable interpretation of backslash escapes" | |
echo -E "disable interpretation of backslash escapes (default)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo ${BASH_VERSION} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
char=a | |
declare -i int | |
int=a | |
declare -p char int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
foo=1 | |
echo $? | |
export foo | |
export bar=1 | |
echo $? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 文字列 | |
string= | |
# 配列 | |
array_1=() | |
# 配列(declare) | |
declare -a array_2=() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 変数 VAR1 を定義 | |
VAR1=1 | |
# 変数 VAR2 を定義 | |
VAR2=2 | |
# 変数 VAR2 をエクスポート | |
export VAR2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
func(){ | |
# var を表示 | |
declare -p LINENO var | |
# var に 2 を代入 | |
var=2 | |
# var を表示 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
bash -c 'declare -p VAR' | |
VAR=1 bash -c 'declare -p VAR' | |
bash -c 'declare -p VAR' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class cbccee4e { | |
public static void main(String[] args) { | |
int[] c1; | |
c1 = new int[3]; | |
c1[0] = 1; | |
c1[1] = 2; | |
c1[2] = 3; | |
for (int i = 0; i < 3; i++) { | |
System.out.println(c1[i]); | |
} |