You are not logged in.

#1 2011-11-07 02:27:19

gromlok
Member
Registered: 2010-04-19
Posts: 154

null

null

Last edited by gromlok (2019-03-10 15:46:58)


.

Offline

#2 2011-11-07 15:32:55

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: null


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#3 2011-11-07 15:46:41

gromlok
Member
Registered: 2010-04-19
Posts: 154

Re: null

null

Last edited by gromlok (2019-03-10 15:47:06)


.

Offline

#4 2011-11-07 17:07:18

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: null

If this script is bash only, you could use bash parameter expansion to get rid of any number of //:

$ DIR="/long//numerous//doubleslashed/path/to/"
$ FILE="file"
$ MYPATH="$DIR/$FILE"
$ cd $MYPATH
bash: cd: /long//numerous//doubleslashed/path/to//file: No such file or directory
$ cd ${MYPATH//\/\//\/}
bash: cd: /long/numerous/doubleslashed/path/to/file: No such file or directory

See http://mywiki.wooledge.org/BashGuide/Pa … _Expansion if you want a better explanation.

Edit: changed variable name from PATH to MYPATH.  Boy was I surprised by bash: pacman: command not found

Last edited by alphaniner (2011-11-07 17:26:02)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

Board footer

Powered by FluxBB