Erro no mount

1. Erro no mount

Christian Carvalho
chriscoliveira

(usa Linux Mint)

Enviado em 19/09/2018 - 09:16h

Estou com um problema ao realizar o mount recebendo 2 variaveis para mapear uma pasta de rede na maquina. os parametros estao sendo passados de um arquivo para outro.
segue exemplo

arquivo1.sh

#!/bin/bash
CAMINHO1="//192.168.0.1/Pasta\ Teste@$HOME/Teste"
VAR=${CAMINHO1/ /*}
arquivo2 $VAR



arquivo2

#!/bin/bash

if [ $1 != "" ]; then

loc=$1
valor1=${loc/"*"/" "}
rede=${valor1%@*}
local=${valor1#*@}

echo "caminho local $local"
echo "caminho na rede $rede"

sudo mount -t cifs -s -o username=$USER,password=$SENHA,rw,users,dir_mode=0777,file_mode=0777 $rede $local
echo $?
fi



se a pasta na rede não tiver espaço no nome ela monta corretamente, mas se tiver um espaço no meio no nome da esse erro.


Uso:
mount [-lhV]
mount -a [options]
mount [options] [--source] <source> | [--target] <directory>
mount [options] <source> <directory>
mount <operation> <mountpoint> [<target>]

Mount a filesystem.

Opções:
-a, --all mount all filesystems mentioned in fstab
-c, --no-canonicalize don't canonicalize paths
-f, --fake dry run; skip the mount(2) syscall
-F, --fork fork off for each device (use with -a)
-T, --fstab <path> alternative file to /etc/fstab
-i, --internal-only don't call the mount.<type> helpers
-l, --show-labels show also filesystem labels
-n, --no-mtab don't write to /etc/mtab
-o, --options <list> comma-separated list of mount options
-O, --test-opts <list> limit the set of filesystems (use with -a)
-r, --read-only mount the filesystem read-only (same as -o ro)
-t, --types <list> limit the set of filesystem types
--source <src> explicitly specifies source (path, label, uuid)
--target <target> explicitly specifies mountpoint
-v, --verbose say what is being done
-w, --rw, --read-write mount the filesystem read-write (default)

-h, --help display this help and exit
-V, --version output version information and exit

Source:
-L, --label <label> synonym for LABEL=<label>
-U, --uuid <uuid> synonym for UUID=<uuid>
LABEL=<label> specifies device by filesystem label
UUID=<uuid> specifies device by filesystem UUID
PARTLABEL=<label> specifies device by partition label
PARTUUID=<uuid> specifies device by partition UUID
<device> specifies device by path
<directory> mountpoint for bind mounts (see --bind/rbind)
<file> regular file for loopdev setup

Operations:
-B, --bind mount a subtree somewhere else (same as -o bind)
-M, --move move a subtree to some other place
-R, --rbind mount a subtree and all submounts somewhere else
--make-shared mark a subtree as shared
--make-slave mark a subtree as slave
--make-private mark a subtree as private
--make-unbindable mark a subtree as unbindable
--make-rshared recursively mark a whole subtree as shared
--make-rslave recursively mark a whole subtree as slave
--make-rprivate recursively mark a whole subtree as private
--make-runbindable recursively mark a whole subtree as unbindable

For more details see mount(8).




Obs: nao posso tirar o espaço do nome....



  


2. Re: Erro no mount

Marcelo Oliver
msoliver

(usa Debian)

Enviado em 19/09/2018 - 15:51h

Boa tarde.
Tenta escapar os espaços, exemplo:
pasta com imagem
pasta\ com\ imagem
sed 's/ /\\ /g' <<< "pasta com imagem"
pasta\ com\ imagem


marcelo oliver






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts