Want to find out the size of a file in Linux/Unix/MacOS bash/ksh/zsh shell?
Try
stat -c%s file
More options: https://www.cyberciti.biz/faq/howto-bash-check-file-size-in-linux-unix-scripting/
seen from China

seen from Australia
seen from United States
seen from Japan
seen from China

seen from United Kingdom
seen from United States
seen from United States

seen from United Kingdom
seen from United States
seen from United Kingdom
seen from Brazil

seen from Malaysia
seen from China

seen from Netherlands
seen from Singapore

seen from Malaysia
seen from United States
seen from Australia
seen from Russia
Want to find out the size of a file in Linux/Unix/MacOS bash/ksh/zsh shell?
Try
stat -c%s file
More options: https://www.cyberciti.biz/faq/howto-bash-check-file-size-in-linux-unix-scripting/
FreeBSD: ログインシェルをbashに変更手順
FreeBSDのログインした時のシェル(ログインシェル)はCシェル系の「csh」「tcsh」となります。chsh コマンドで、ログインシェルを「bash」に変更する手順になります。(2019/04/14作成)
MichaelGaida / Pixabay
(more…)
View On WordPress
my first note in this book
シェルのリダイレクト
crontabを使って定期的に処理を実施させることがしばしばあるのですが、 出力内容とかエラーとか拾ったりしたいので
[exec_file] > [log_file] 2>&1
とかやってるのですが、この間、これやったときに、
曖昧な出力リダイレクトです.
というアラートを返されて処理が実行できなかったという問題があったのでメモ書き。
http://www.rsch.tuis.ac.jp/~ohmi/literacy/stdio.html
ここにあるとおり、 そもそも > っていうのはリダイレクト(リダイレクション)というもので、 標準入出力の切り替えのために使うもの。
[exec_file] < [input_data]
なんてこともしばしばやってますね。 で、このリダイレクションの書き方が、シェルによって地味に違うそうな。
http://uguisu.skr.jp/Windows/csh.html
何で違うのかはよくわからないからおいておいて、 冒頭に書いた「2>&1」という書き方、tcshではだめっぽく、それが原因でアラートにつながっていた模様。
http://rarihoma.s601.xrea.com/post-2013-11-25-01
ここのサイトの結論にもありましたが、「>&」使うのが無難なのかな、と。 まぁ、crontabに仕掛ける前に、実際に実行して通るかどうか、試してなかったのがまずかったんですけどね。
Fixed: Force SSH to use a specific shell #computers #dev #development
Fixed: Force SSH to use a specific shell #computers #dev #development
Force SSH to use a specific shell
Is there any way to force SSH to use a particular shell on the remote end, regardless of what the user’s default shell is?
I’ve tried solutions akin to:
ssh host.domain.com /bin/bash -c 'complicated, multi-line command'
but unfortunately the default shell on the remote end is responsible for parsing the “complicated, multi-line command” part, and I’m having…
View On WordPress
Fix: Force SSH to use a specific shell #it #programming #answer
Fix: Force SSH to use a specific shell #it #programming #answer
Force SSH to use a specific shell
Is there any way to force SSH to use a particular shell on the remote end, regardless of what the user’s default shell is?
I’ve tried solutions akin to:
ssh host.domain.com /bin/bash -c 'complicated, multi-line command'
but unfortunately the default shell on the remote end is responsible for parsing the “complicated, multi-line command” part, and I’m having…
View On WordPress
Resolved: Can a shell script set environment variables of the calling shell? #computers #answer #programming
Resolved: Can a shell script set environment variables of the calling shell? #computers #answer #programming
Can a shell script set environment variables of the calling shell?
I’m trying to write a shell script that, when run, will set some environment variables that will stay set in the caller’s shell.
setenv FOO foo
in csh/tcsh, or
export FOO=foo
in sh/bash only set it during the script’s execution.
I already know that
source myscript
will run the commands of the script rather than launching a new…
View On WordPress
Resolved: How to determine the current shell I'm working on? #fix #dev #solution
Resolved: How to determine the current shell I'm working on? #fix #dev #solution
How to determine the current shell I’m working on?
How can I determine the current shell I am working on?
Would the output of the ps command alone be sufficient?
How can this be done in different flavors of UNIX?
Answer [by Peter Lamberg]: How to determine the current shell I’m working on?
If you just want to ensure user is invoking script with bash:
if [ ! -n "$BASH" ] ;then echo Please run…
View On WordPress