Anon
06/24/2024 (Mon) 14:10
No.10540
del
>>10526>classic horse colorsmane 5/6
>>10536>ifuse...sudo...mv...Doesn't actually move the files. Not much of a problem, but something to be aware of.
More CLI information... I have been copying CIDs from one computer to another (in both directions). HPC is the computer with a program uptime of 31 days straight now. I improved the command I'm using to do some of that:
$ ssh hpc@10.1.2.3 "export IPFS_PATH=/path; ipfs pin ls --type=recursive" | sed "s/ .*//g" | \
sort | uniq | xargs -d "\n" sh -c 'for args do a() { ipfs --offline pin add --progress $args || \
ssh hpc@10.1.2.3 "export IPFS_PATH=/path; ipfs dag export $args" | ipfs dag import --stats; }; \
echo ====== $args; ipfs pin ls --type=recursive $args || a; done' _
. Can declare and use a function in sh/xargs.
. "ipfs --offline..." tries pinning it in offline mode: this saves on the need to grab it from another computer if it succeeds
. if offline pinning fails, do get it from the other computer
How the "||" operator works in Bash: do the command only if the previous one failed, only applies to one statement. Details... "echo snowpity | grep mare || echo Mare not found"->"Mare not found"; "echo mare | grep mare || echo Mare not found"->"mare". This is basic stuff, but what about running multiple commands only if the previous one failed? (See "echo $?" for exit code of previous command.) Use a function:
>$ a() { echo Rainbow Dash ran so far...; echo ...that the extreme running made her taste blood in her mouth.; }; echo snowpity | grep mare || a>Rainbow Dash ran so far...>...that the extreme running made her taste blood in her mouth.
Message too long. Click here to view full text.