2022-06-12 09:38:38 +02:00
|
|
|
function append(args:Array<string>, curdir:any):string {
|
|
|
|
var buf = "";
|
|
|
|
if (args.length == 0) {
|
|
|
|
buf += "append: missing operand\n";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (curdir[args[0]] == undefined) {
|
|
|
|
curdir[args[0]] = "";
|
|
|
|
}
|
2022-06-17 21:06:49 +02:00
|
|
|
else {
|
|
|
|
buf += "append: file already exists\n";
|
|
|
|
}
|
2022-06-12 09:38:38 +02:00
|
|
|
for (let i = 1; i < args.length; i++) {
|
|
|
|
curdir[args[0]] += args[i] + "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
export { append };
|