dotinstall:~ $ echo {a,b,c}
a b c
dotinstall:~ $ echo {1..10}{a..g}
1a 1b 1c 1d 1e 1f 1g 2a 2b 2c 2d 2e 2f 2g 3a 3b 3c 3d 3e 3f 3g 4a 4b 4c 4d 4e 4f 4g 5a 5b 5c 5d 5e 5f 5g 6a 6b 6c 6d 6e 6f 6g 7a 7b 7c 7d 7e 7f 7g 8a 8b 8c 8d 8e 8f 8g 9a 9b 9c 9d 9e 9f 9g 10a 10b 10c 10d 10e 10f 10g
dotinstall:~ $ mkdir test && cd test
dotinstall:~/test $ mkdir app{1..5}
dotinstall:~/test $ ls
app1 app2 app3 app4 app5
dotinstall:~/test $ touch app{1..5}/test{1..3}{.jpg,.png,.gif}
dotinstall:~/test $ ls app2
test1.gif test1.png test2.jpg test3.gif test3.png
test1.jpg test2.gif test2.png test3.jpg
]dotinstall:~/test $ ]rm app{1..5}/test{1..3}{.jpg,.gif}
bash: ]rm: command not found
dotinstall:~/test $ rm app{1..5}/test{1..3}{.jpg,.gif}
dotinstall:~/test $ ls app2
test1.png test2.png test3.png
dotinstall:~/test $ cd
dotinstall:~ $ rm -r test/
dotinstall:~ $
カテゴリー: Uncategorized
UNIX パイプ
dotinstall:~ $ ls -l /etc/
total 208
-rw-r–r– 1 root root 7 May 29 2020 alpine-release
drwxr-xr-x 1 root root 4096 Sep 23 2020 apk
drwxr-xr-x 3 root root 4096 Sep 23 2020 ca-certificates
-rw-r–r– 1 root root 5613 Jun 18 2020 ca-certificates.conf
drwxr-xr-x 2 root root 4096 May 29 2020 conf.d
drwxr-xr-x 2 root root 4096 May 29 2020 crontabs
-rw-r–r– 1 root root 89 May 29 2020 fstab
-rw-r–r– 1 root root 693 Sep 23 2020 group
-rw-r–r– 1 root root 682 May 29 2020 group-
-rw-r–r– 1 root root 13 Dec 27 18:11 hostname
-rw-r–r– 1 root root 178 Dec 27 18:11 hosts
drwxr-xr-x 2 root root 4096 May 29 2020 init.d
-rw-r–r– 1 root root 570 May 29 2020 inittab
-rw-r–r– 1 root root 1748 Feb 9 2020 inputrc
-rw-r–r– 1 root root 54 May 29 2020 issue
-rw-r–r– 1 root root 309 Aug 9 2020 localtime
drwxr-xr-x 2 root root 4096 May 29 2020 logrotate.d
drwxr-xr-x 2 root root 4096 May 29 2020 modprobe.d
-rw-r–r– 1 root root 15 May 29 2020 modules
drwxr-xr-x 2 root root 4096 May 29 2020 modules-load.d
-rw-r–r– 1 root root 283 May 29 2020 motd
lrwxrwxrwx 1 root root 12 Dec 27 18:11 mtab -> /proc/mounts
drwxr-xr-x 8 root root 4096 May 29 2020 network
drwxr-xr-x 2 root root 4096 May 29 2020 opt
-rw-r–r– 1 root root 164 May 29 2020 os-release
-rw-r–r– 1 root root 1233 Sep 23 2020 passwd
-rw-r–r– 1 root root 1172 May 29 2020 passwd-
drwxr-xr-x 7 root root 4096 May 29 2020 periodic
-rw-r–r– 1 root root 238 May 29 2020 profile
drwxr-xr-x 1 root root 4096 Sep 23 2020 profile.d
-rw-r–r– 1 root root 1865 May 29 2020 protocols
-rw-r–r– 1 root root 54 Dec 27 18:11 resolv.conf
-rw-r–r– 1 root root 65 May 22 2020 securetty
-rw-r–r– 1 root root 14464 May 29 2020 services
-rw-r—– 1 root shadow 454 Sep 23 2020 shadow
-rw-r—– 1 root shadow 422 May 29 2020 shadow-
-rw-r–r– 1 root root 48 Sep 23 2020 shells
drwxr-xr-x 1 root root 4096 May 29 2020 ssl
-rw-r–r– 1 root root 3941 May 25 2020 sudo.conf
-rw-r–r– 1 root root 6169 May 25 2020 sudo_logsrvd.conf
-rw-r–r– 1 root root 3228 Sep 23 2020 sudoers
drwxr-x— 2 root root 4096 Sep 23 2020 sudoers.d
-r–r—– 1 root root 3174 May 25 2020 sudoers.dist
-rw-r–r– 1 root root 53 May 29 2020 sysctl.conf
drwxr-xr-x 2 root root 4096 May 29 2020 sysctl.d
drwxr-xr-x 13 root root 4096 Sep 23 2020 terminfo
-rw-r–r– 1 root root 5306 May 22 2020 udhcpd.conf
dotinstall:~ $ ls -l /etc/ | grep ‘sudo’
-rw-r–r– 1 root root 3941 May 25 2020 sudo.conf
-rw-r–r– 1 root root 6169 May 25 2020 sudo_logsrvd.conf
-rw-r–r– 1 root root 3228 Sep 23 2020 sudoers
drwxr-x— 2 root root 4096 Sep 23 2020 sudoers.d
-r–r—– 1 root root 3174 May 25 2020 sudoers.dist
dotinstall:~ $ ls -l /etc/ | grep ‘sudo’ | wc -l
5
dotinstall:~ $ ls -l /etc/ | grep ‘sudo’ | wc -l > results.txt
dotinstall:~ $ cat results.txt
5
dotinstall:~ $ rm results.txt
dotinstall:~ $
UNIX リダイレクション
date
dotinstall:~ $ echo ‘cal’ > commands.txt
dotinstall:~ $ cat commands.txt
cal
dotinstall:~ $ echo ‘date’ >> commands.txt
dotinstall:~ $ cat commands.txt
cal
date
dotinstall:~ $ /bin/ash < commands.txt
December 2022
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Tue Dec 27 20:04:43 JST 2022
dotinstall:~ $ /bin/ash < commands.txt > results.txt
dotinstall:~ $ cat results.txt
December 2022
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Tue Dec 27 20:05:01 JST 2022
dotinstall:~ $ rm ‘
>
C# 変数の型
using System;
class MyApp
{
static void Main()
{
// 変数: 再代入が可能
// 定数: 再代入が不可能
string s = “hello”;
char c = ‘a’;
int i = 100;
double d = 52342.34;
float f = 23.3f;
//論理
bool flag = true;
var x = 5;
var y = “world”;
}
}
C言語練習問題5
#include <stdio.h>
int main(void)
{
int money,potion,ether,sword,shield,payment,change;
double tax;
potion = 100;
ether = 1000;
sword = 1500;
shield = 500;
money = 10000;
tax = 1.10;
payment = (int)((potion + ether * 2) * tax);
change = money – payment;
printf(“%dGn”,change);
return 0;
}
【C++入門】基本入出力
https://www.youtube.com/watch?v=DiI-oqWIVCc
【C++入門】C++とは
C++ アクセス指定
C++ アクセス指定
private
protected
public
//列挙型
enum class MarioState
{
Small,
Normal,
Fire,
Bean
};
class Mario
{
//メンバー変数
int m_state; //状態
float m_jumpPower: //ジャンプ力
//メンバ関数
void Jump();
void Walk();
void Dash();
void Fire();
MarioState GetState()
{
return m_state;
};
int main()
{
Mario a;
if(a.GetState() == MarioState();
};
a.m_state = MarioState::Small;
return 0;
}
//命名規則
アンダースコア(_)で始まる名前はNG
変数名は小文字で始めたい
関数名は小文字で始めたい
関数名は同市から始めたい
単語の区切り方
/スネーク記法 have_key_for_pc
/キャメル記法 HaveKeyForPc
/パスカル記法 haveJeyForPc
/ハンガリ記法 bHavekeyForPc
*/
論理型 bool
整数型 int
文字型 char
文字列挙がtあ
2バイト整数
4バイト整数
ハンドル void
符号なし整数 unsigned
char 1バイト
unsigned char 1バイト
[C#]WriteLineメソッドとインデックス
using System;
class console02
{
public static int Main()
{
string cat = “猫” , dog = “犬”;
Console.WriteLine(“{0}はあほですが、{1}は賢いです”,cat,dog);
return 0;
}
}
http://www.kumei.ne.jp/c_lang/cs/cs_02.htm
C#プログラミングTips:文字列処理に関するヒント
http://www.atmarkit.co.jp/fdotnet/csharptips/010string/010string.html
C言語 構造体
#include <stdio.h>
typedef struct {
int kokugo;
int suugaku;
int eigo;
float heikin;
} kousa;
kousa calcHeikin(kousa in)
{
in.heikin = (in.kokugo
+ in.suugaku + in.eigo) / 3.0;
return in;
}
int main()
{
kousa a;
a.kokugo = 50;
a.suugaku = 70;
a.eigo;
a = calcHeikin(a);
printf(“国語の得点: %3dn”,a.kokugo);
printf(“数学の得点: %3dn”, a.suugaku);
printf(“英語の得点: %3dn”, a.eigo);
printf(“平均点 : %5.1fn”, a.heikin);
}
http://www.cc.kyoto-su.ac.jp/~yamada/pB/struct.html#struct