-1

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?

2
  • It is unclear what you're asking. What is preventing you from placing this in a script? Commented Oct 16, 2020 at 9:33
  • 1
    Does this answer your question? Creating a shell script version of terminal commands Commented Oct 23, 2020 at 3:43

2 Answers 2

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
0
echo "mount --bind /dev/xyz /abc" >mount.sh && chmod 755 mount.sh && ./mount.sh
1
  • Nice one-liner. :) Commented Oct 20, 2020 at 9:24

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.