[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Ubuntu automount NTFS partition

Posted on 2010-01-06
3
Medium Priority
?
433 Views
Last Modified: 2013-12-26
I am trying to get to write a bash script which will find the ntfs partition and it will put it on fstab without intervention. I need help with my script, I get the following errors:

./automount.sh: line 7: syntax error near unexpected token `;'
./automount.sh: line 7: `cat /tmp/ntfs| while read line;do; '

Thanx for your help
#!/bin/bash

MOUNT=/mnt/ntfs


fdisk -l | grep NTFS | awk '{print $1}' >> /tmp/ntfs
cat /tmp/ntfs| while read line;do; 
echo `$line    /mnt/ntfs	ntfs-3g defaults,locale=en_US.utf8 0 0` >> ntfs.fstab;
done

Open in new window

0
Comment
Question by:dpoper1
3 Comments
 
LVL 3

Expert Comment

by:skymo
ID: 26197671
you dont need the ; after the do - just remove it
0
 
LVL 23

Accepted Solution

by:
Maciej S earned 1000 total points
ID: 26197773
Shorter version, without additional while loop:
fdisk -l | awk '/NTFS/ {printf "%s\t/mnt/ntfs\tntfs-3g defaults,locale=en_US.utf8 0 0\n", $1}' >> ntfs.fstab

Open in new window

0
 

Author Closing Comment

by:dpoper1
ID: 31673897
Great!!!!!!!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses
Course of the Month17 days, 15 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question