[SATLUG] BASH script not writing to file

John Champion satlugacct at jchampion.com
Wed Mar 28 11:41:47 CDT 2012


Hi,

I've tried several things with a very basic BASH script to try to figure
out what is going on and I cannot make heads or tails out of it.

Here's the script:

#!/bin/bash
read -p "What's your name" fname
echo -e "You typed in $fname" > ./Documents/test.txt

This works fine in a pure Linux install. This does not work in the VM. It
is simply not writing to the file. I cannot get stderr to write to a file
either.

It's as if the VM is locked even though I'm running this as root (did this
to see if that made a difference and it didn't).

Thanks,
john

On Tue, Mar 27, 2012 at 8:28 PM, Rabie Khabouze <rabie at rabie.net> wrote:

> Just Curious, are you trying to write in a Shared folder in the VM ?
> because that might be some permissions issues.
>
>
>
>
> On 03/27/2012 05:28 PM, Michael Endsley wrote:
>
>> Would I be correct in assuming that if you were to redirect stderr to a
>> file/stdout, you might be able to get more information on what the problem
>> is? Or is this an instance where errors should be showing up without any
>> redirects? You can redirect stderr to a file with 2>  somefile.txt or
>> redirect them to stdout (so you see them in the terminal upon execution)
>> with 2>&1. Hope it helps.
>>
>> On Tue, Mar 27, 2012 at 3:32 PM, Henry Pugsley<henry.pugsley at gmail.**com<henry.pugsley at gmail.com>
>> >wrote:
>>
>>  On Tue, Mar 27, 2012 at 3:23 PM, John Champion<satlugacct at jchampion.**
>>> com <satlugacct at jchampion.com>>
>>> wrote:
>>>
>>>> Hello,
>>>>
>>>> Has anyone ever encountered an instance where a BASH script, written in
>>>> Debian, will not write to a text file where both script and text file
>>>>
>>> were
>>>
>>>> on a virtual machine?
>>>>
>>>> I am using Debian on a VMWare platform. When I use the script on a
>>>> Debian
>>>> dual boot, the script writes fine but when I try this in the virtual
>>>> environment, something changes and I can't tell what.
>>>>
>>>> Thanks
>>>> john
>>>>
>>> Double check all of your file paths in the script and your
>>> environment, as well as file/directory permissions.  Make sure that
>>> you're using absolute paths where possible.  Also make sure that
>>> you're running the same version of bash and that you're not really
>>> using dash, which is the new default for /bin/sh.  If you are using
>>> any bash'isms then you'll get unexpected behavior.
>>> --
>>> ______________________________**_________________
>>> SATLUG mailing list
>>> SATLUG at satlug.org
>>> http://alamo.satlug.org/**mailman/listinfo/satlug<http://alamo.satlug.org/mailman/listinfo/satlug>to manage/unsubscribe
>>> Powered by Rackspace (www.rackspace.com)
>>>
>>>
>
> --
> Rabie Khabouze
> _____________________
> Mi Net Services
> 1306 Coral Bay
> 78251 San Antonio, TX
> Tel: (+1) 210-645-5523
>
> --
> ______________________________**_________________
> SATLUG mailing list
> SATLUG at satlug.org
> http://alamo.satlug.org/**mailman/listinfo/satlug<http://alamo.satlug.org/mailman/listinfo/satlug>to manage/unsubscribe
> Powered by Rackspace (www.rackspace.com)
>


More information about the SATLUG mailing list