Inline Variable Refactoring
The inline refactoring lets you replace a variable reference with its assigned value.
Usage
Place the text cursor on the variable declaration or reference you would like to inline. Then invoke Refactor → Inline… to start the operation.
If you inline a variable declaration, then all references will be inlined without prompting you. If you line a variable reference, then you can choose if you would like to inline this reference only or all references of the declaration.
![Inlining a variable reference in a shell script](/pngs/editor/refactorings/inline_variable_dialog.zh-cn_400.fe952c1a993e68b43ae319b66cb97b00.png)
Examples
Simple Values
Inlining a value handles unquoted and quoted references.
![Inlining a reassigned variable](/pngs/editor/refactorings/inline_variable_string.zh-cn_400.7b7492181ed4b758b27eb14d8ed5fe5d.png)
![](/pngs/editor/refactorings/inline_variable_string_after.zh-cn_400.63188504017adfba05fe24fb24b2cf08.png)
Reassigned Variables
If you inline the value of a reassigned variable, then the last assigned value is inlined.
![Inlining a reassigned variable](/pngs/editor/refactorings/inline_variable_reassigned.zh-cn_400.d7907b38ba25029cf2516f15c3d32264.png)
![](/pngs/editor/refactorings/inline_variable_reassigned_after.zh-cn_400.43c38fffa6bddd8f7fc6ea8c346ac790.png)