0

I am mounting a directory /dev/xyz to folder /abc using command

   mount --bind /dev/xyz 
   /abc

How could I use this command using shell script?

Gaurav Baghel
  • 37
  • 1
  • 9
  • It is unclear what you're asking. What is preventing you from placing this in a script? – Panki Oct 16 '20 at 09:33
  • 1
    Does this answer your question? [Creating a shell script version of terminal commands](https://unix.stackexchange.com/questions/611694/creating-a-shell-script-version-of-terminal-commands) – muru Oct 23 '20 at 03:43

2 Answers2

1
echo "mount --bind /dev/xyz /abc" >mount.sh && chmod 755 mount.sh && ./mount.sh
Stéphane Chazelas
  • 522,931
  • 91
  • 1,010
  • 1,501
purval_patel
  • 215
  • 1
  • 2
  • 7
0

Almost the same way. Just create a bash script:

vi mount.sh

Insert or i is responsible for inserting. Right button of the mouse for pasting. Esc for exiting the insert mode, Then all you have to do after Esc is to type :x to save and exit the bash script file edition mode.

Add a shebang check what shebang is at Wikipedia

Add a command to the file below the shebang.

mount --bind /dev/xyz /abc

Make bash script executable using

chmod +x mount.sh
Sysadmin
  • 286
  • 1
  • 5