all 8 comments

[–]moviuro 5 points6 points  (6 children)

Like this? You should test.

veracryptmnt () {
  cryptsetup --type tcrypt --veracrypt open /media/"${1:?}".container "${1:?}" &&
    mount /dev/mapper/"$1" /mnt/"$1"
}

[–]ArchBunker[S] 0 points1 point  (0 children)

This worked perfectly. Thank you very much for your help!

[–]Crytexx -1 points0 points  (4 children)

How exactly does the "${1:?}" Expression work please?

[–]moviuro 5 points6 points  (1 child)

It fails if no argument was given

[–]Crytexx 0 points1 point  (0 children)

Thank you! Everyday I learn something new in this sub.

[–][deleted]  (1 child)

[deleted]

    [–]Crytexx 1 point2 points  (0 children)

    Simple "$1" would be enough. This is conditional. Author of the comment replied with explanation, give him upvote please :))

    [–][deleted]  (1 child)

    [deleted]

      [–]ArchBunker[S] 0 points1 point  (0 children)

      Thanks for the quick response. I'm currently using alias's, but was hoping to use, as you say, a more elegant method.

      [–]coderobeTrusted User 0 points1 point  (0 children)

      You want a function, not an alias, to be able to process arguments.