Useful shortcuts for vi editor

Showing posts with label escape sequences. Show all posts
Showing posts with label escape sequences. Show all posts

Tuesday, 27 August 2019

How to drop database/user on logical replicated database?

1st step
on 2nd node:
$ echo "DROP SUBSCRIPTION exampledb_node_2" | psql

on 1st node:
$ echo "DROP PUBLICATION exampledb_node_1" | psql

2nd step
on 1st node:
$ echo -e "DROP DATABASE exampledb \n" | psql
$ echo "DROP USER \"user-example\"" | psql

on 2nd node:
$ echo -e "DROP DATABASE exampledb \n" | psql
$ echo "DROP USER \"user-example\"" | psql

Sunday, 19 May 2019

Examples of "escape sequences" usage on echo command

To use interpretation of backslash escapes, just need to put "-e" parameters afterward echo command.

Info: "-e" means enable escape sequences

Examples of backslash escapes:
New line;
$ echo -e "Hello World\n"
-> Hello World

Form feed;
$ echo -e "Hello World\fWhat a lovely day\fI like this\f"
-> Hello World
            What a lovely day
                              I like this

Carriage return;
$ echo -e "Hello World\rWorld"
-> World World

Horizontal tab;
$ echo -e "Hello World\tWhat a lovely day"
-> Hello World     What a lovely day

Vertical tab;
$ echo -e "Hello World\vWhat a lovely day"
-> Hello World
           What a lovely day

Null;
$ echo -e "Hello World\0 What a lovely day"
-> Hello World What a lovely day

Clear after all;
$ echo -e "Hello World\c What a lovely day"
-> Hello World

Escape character;
$ echo -e "Go to \\home directory"
-> Go to \home directory

$ echo -e "Go to \"home\" directory"
-> Go to "home" directory

Unicode usage;
$ echo -e "This is turkish lira symbol-> \u20ba"
-> This is turkish lira symbol-> ₺