In this chapter we'll look at a seemingly trivial detail-our shell. This examination would reveal some of the inner working of the shell and the terminal emulator program itself.Many things in linux,the shell prompt was highly configurable,and while we had pretty much taken it for granted,th E prompt is a really useful device once we learn how to control it.Anatomy (anatomy) of A PromptOur default prompt looks something like this:Notice that it contains we user Name,our host name and our current
Linux command prompt can be changed according to personal preferences, modify the value of PS1;Under Ubuntu, if only the individual users under the modification of ~/.profile file, all users of the unified modified/etc/profile;Join:Export ps1= ' [/[email protected]/h/w/]/$ 'where/u displays the current user account/h Displays the current host name/w Displays the current path (uppercase W is a relative path,
+Q unlock Command terminalFour, in the end need to add a bit of knowledge, environment variable path: Environment variables are strings that contain information about the environment of the system and the currently logged-on user, and the shell initializes different environments for different users when it is started, and when the shell is called, it reads commands from both initial files. The/etc/profile contains system variables, which are maintained by the system administrator, and are set by
MAC: Remove the computer name of the terminal default prefix1, open the terminal input sudo vi/etc/bashrc, prompted to enter the password is the computer's password.2. Click I to change the edit mode to insert to modify the document, use the # comment ps1= ' \h:\w \u\$ ' and add ps1= ' \w \$ ' at the same time.#PS1 = ' \h:\w \u\$ '
side, along with our custom variables, are declared.How do I set a variable in front of you, and what if I want to cancel a variable? Just enter "unset variable name".With unset ABC, the Echo $abc will no longer output any content." configuration files for system environment variables and personal environment variables "It says a lot about the variables of the system, so where are these variables stored in the Linux system, and why do users automatically have these variables when they log on to
variable, so that the shell's child shell also know that the value of the variable ABC is 123. If export does not add any variable names, it declares all variables.
At the end, we are declared with our custom variables.
How do I set a variable in front of the light, and what if I want to cancel a variable? Just type "unset variable name".
With unset ABC, echo $ABC no longer outputs any content.
" configuration files for system environment variables and personal environment variables "
Checking whether a file or folder path exists is a feature that is often used in programming. PowerShell provides a very handy cmdlet for this requirement, which is test-path! Oh, look at a name, you know how professional it is. Take a look at the basic introduction to it first:
Test-path, check to see if the path exists.
Syntax: Test-path Description: The path here can be: file, folder, HKLM Path, environment variable env: path
Here are some examples to make it easier for us to understand:
Re.next (); intN=re.getint (1); System.out.println ("The natural growth of the serial number is" +N); Simplecon.close (re); Simplecon.close (PS); PreparedStatement PS1=con.preparestatement (SQL1); Ps1.setint (1, N); Blob pic=Con.createblob (); Create a binary type OutputStream out=pic.setbinarystream (1); Returns a stream, flows to the binary repository, and sets the position to the i
Statement will have a bug about SQL injection, so I don't useGeneral use PreparedStatementImport java.sql.Connection;Import java.sql.PreparedStatement;Import Java.sql.ResultSet;Import Com.huawei.utils.DBUtil;public class TestJDBC02 {public static void Testpreparedstatement () throws exception{/*** Preprocessing SQL statements does not present a bug with SQL injection*/Connection Connection = Dbutil.getconnection ();String sql = "SELECT * from Users where username=?";Getting preprocessing objects
/profile file and insert the following content at the end of the file:
_________________________________________________
# Add by zws
# Customize less
# LESS = '-M-Q-R'
PS1 = "[\ u @ \ h \ w] \ $"
INPUTRC =/etc/inputrc
LESS = '-M-R' #-r for ls | less supports color.
LESSEDIT = "% E? Lt + % lt. % f"
LESSOPEN = "| lesspipe. sh % s"
LESSCHARSET = latin1
PAGER = less
Export LESS LESSEDIT LESSOPEN LESSCHARSET INPUTRC
_______________________________________
deleted the email with subject $ ($individualEmail. Subject) from $Mailbox "}}}#=============================== script end ===== =============================================== 7 to perform bulk deletion of a specified topic list message The Saves the above script as a. PS1 script, which is saved as EWS01.PS1 in this example. Next, create a ACTION_EWS.PS1 script to invoke the Ews01.
1, let the bash command line display the current branch and show the submission status and use different color highlighting to distinguish:650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7A/07/wKiom1ahAZSStKCoAABFTGH-2c4417.png "title=" 1.png " alt= "Wkiom1ahazsstkcoaabftgh-2c4417.png"/>After entering the working directory of Git, display the name of the current branchIf there is a version that has been tracked without staging, use the red * hintIf you have a tracked uncommitted versi
and Andy Gavin together for the PS1 to write the game "The Ancient Wolf" (Crash Bandicoot).At the time, Ram remained the main problem. PS1 only has 2MB of RAM, however we have to do something crazy to make the game fit the hardware. Our game data is about 10MB in size, so we have to do dynamic paging input and output (paged in and out dynamically), although the load lag frame rate drops to 30Hz, but we don
How to modify a Linux Command Prompt
How to modify the Linux Command Prompt:Modify the Linux Command Prompt to modify the Linux environment variable PS1. You can use VI to edit the/etc/profile file and add:Export PS1 = '[\ U @ \ H \ W] \ $'You can also edit it ~ /. Profile file (note the first line #/etc/profile ~ /. Profile)Where \ U shows the current user account, \ h shows the current host name, \ W show
Profile or environment. You can configure one of them.
Profile:
#/Etc/profile: System-wide. profile file for the Bourne shell (SH (1 ))
# And Bourne compatible shells (bash (1), KSh (1), ash (1),...). If ["$ PS1"]; then
If ["$ Bash"]; then
PS1 = '\ U @ \ H: \ W \ $'
If [-F/etc/bash. bashrc]; then
./Etc/bash. bashrc
Fi
Else
If ["'id-U'"-EQ 0]; then
PS1 = '#'
Els
commands like this, such as Echo "hello", CD... and so on. From this point of view, it is a command line that implements the original command line function. But is powershell an enhanced version of the command line, or is it a superset of the command line? This is really not the case. I will discuss this issue in the future.
Just like running an application in the command line, you can run the application in the powershell interaction window as follows:
PS c: \ Users \ v-lukez> notepadps c:
In Linux bash shell, semicolons in statements are generally used as code block identifiers.
1. A single-line statement generally uses semicolons to distinguish code blocks. For example:
Weblogic @ pmtest:/$ if ["$ PS1"]; then echo test is OK; fiTest is OK
In this script or command line, two semicolons are required for the correct statement. The first Semicolon is the semicolon before then, used to identify the end Of the condition block, and the secon
Simple sha1 encryption function example implemented by PHP and phpsha1 encryption example
This example describes the sha1 encryption function implemented by PHP. We will share this with you for your reference. The details are as follows:
function encryptTokey($data){ $apikey = 'testapikey111'; $ps1 = sha1($apikey . strtolower($data)); $ps1 = strtoupper($ps1
script file for execution. The content of the Hello. ps1 script file is as follows:
$a = "Hello"
$a
echo $a > a.txt
dir a.txt
The execution results of the Hello. ps1 script file are as follows:
PS E:\> D:\Projects\Practise\PowerShell\Hello.ps1
Hello
Directory: E:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 1/30/2013 4:56 PM 16 a.txt
You may find that the PowerShell scr
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.