LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-29-2009, 02:49 AM   #1
silos
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Rep: Reputation: 1
Unhappy Linux scripting: simple bash script - where is the bug?


Here is my script (named "tc-workaround"):

Code:
#!/bin/bash

echo "TrueCrypt NTFS read-write workaround 1.0"
echo "Enter the name of the NTFS-formatted file/device:"
read device
echo "Is this a system-volume (y/n)?"
read system
if [ "$system" = "y" ]; then $system = "-m system "
else
$system = ""
fi
truecrypt $system--filesystem=ntfs-3g --fs-options force --mount "$device"
and the output is:

Code:
TrueCrypt NTFS read-write workaround 1.0
Enter the name of the NTFS-formatted file/device:
/dev/sda3
Is this a system-volume (y/n)?
y
./tc-workaround: line 8: y: command not found
What have I done wrong?
system: Debian 5.0.3 (Lenny, stable)
 
Old 10-29-2009, 02:59 AM   #2
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
when you assign values to variables, there should not be a $ infront of the name. also, spaces not allowed between = sign during variable assignment.
 
Old 10-29-2009, 03:16 AM   #3
xaler
LQ Newbie
 
Registered: May 2009
Location: the zero world
Distribution: F11, U9.04, Gentoo
Posts: 20

Rep: Reputation: 1
Quote:
Originally Posted by silos View Post
Code:
.....
then $system = "-m system "
........
I changed your code and tried in cygwin

Code:
.....
then system="-m system "
........
No problems in the output... notice the change...

Last edited by xaler; 10-29-2009 at 03:24 AM.
 
Old 10-29-2009, 05:38 AM   #4
silos
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Original Poster
Rep: Reputation: 1
Thumbs up Debian TrueCrypt NTFS read-write workaround

So here is the final version of my script.
Maybe it will help somebody.
It allows to mount NTFS-formatted TrueCrypt volumes on Debian in read-write mode which is impossible by default.

Code:
#!/bin/bash

echo "TrueCrypt Debian NTFS read-write workaround 1.0 by Silos"
echo "Enter the name of the NTFS-formatted TrueCrypt device or file,"
echo "for example /dev/sda1 or file.tc:"
read device
echo "Is this a system-volume (y/n)?"
read system
if [ "$system" = "y" ]; then system="-m system "

else
system=""
fi
truecrypt $system--filesystem=ntfs-3g --fs-options=force --mount $device
It requires the ntfs-3g package and of course the TrueCrypt.

Last edited by silos; 10-29-2009 at 07:10 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] simple bash scripting help ArfaSmif Linux - General 2 04-18-2009 06:52 AM
simple bash scripting help shorun Linux - General 2 07-31-2007 07:26 AM
Very simple BASH scripting question clickster Linux - Newbie 6 11-23-2005 04:28 PM
bash scripting problem (bug?) zz9pluralzalpha Linux - Software 2 04-12-2005 01:51 PM
Bash Scripting--Simple Question mooreted Linux - General 4 05-10-2004 01:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration