shell

Now that you think you have the package manager installed, try installing curl first.

# windows
scoop install curl

# mac
brew install curl

# linux(ubuntu)
sudo apt install curl

Then, execute the following command in terminal.

curl https://bsky.social/xrpc/_health

The result should return the pds version of bluesky(bsky.social) as follows

output

{"version":"b2ef3865bc143bfe4eef4a46dbd6a44053fa270d"}

If curl does not work properly, it may be that the installed binaries do not have a path.

This is also likely to occur mainly on windows.

Here is a little explanation about paths.

path

When the terminal is started, a program called shell is waiting there.

The user executes commands through this shell.

There are various kinds of shells.

For example, windows has microsoft's cmd and pwsh shells.

For unix(mac), linux(ubuntu), there are bash, zsh and so on.

The shell can omit directories added to PATH when executing commands.

For example, suppose curl is installed in /usr/bin/curl. In this case, shell should execute the following command

/usr/bin/curl --help

However, if /usr/bin is added to the PATH, the directory description can be omitted.

curl --help

To find the location of the main body of the program (binary), use the following command.

which curl

However, it cannot be used unless the path is passed.

To pass path, put the directory in question in an environment variable.

PATH=$PATH:/usr/bin

Note that a directory is sometimes called a dir or folder.

Notation "$"

Next, a note on the description format of shell.

which curl
$ which curl
`

These have the same meaning.

If you are describing the execution of a shell in writing, it is customary to prefix it with `$.

This `$ means "run in shell".

For example, if you want to include the result of the command with the execution, it would be as follows.

$ which curl
/usr/bin/curl

This is because it is often the case that you want to put the command and the result together, and if there is no $, it will be difficult to tell which is the command and which is the result.

In this manual, `$ is omitted as much as possible to avoid the harm of copying.

However, it is believed that all code layouts should include $ when executed in shell.

shebang

Next, we will discuss shell script and shebang.

This area varies from shell to shell, but we will assume bash.

Please write the following in a text file, give it execute permission, and run it.

test.sh

#! /bin/bash
curl https://bsky.social/xrpc/_health

The following command grants execute permission and executes it.

chmod +x test.sh
. /test.sh

Then the version of bsky.social will be output.

{"version": "b2ef3865bc143bfe4eef4a46dbd6a44053fa270d"}

The first line of the text file #!/bin/bash is what is called a shiban.

Here, it specifies which programming language the text file is to be executed in.

The following is a brief description of the programming language.

results matching ""

    No results matching ""