CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Installation

[OpenFOAM.org] OpenFOAM 4.0, bad option -t in zsh

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By Taataa
  • 1 Post By rdbisme

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 31, 2016, 06:16
Default OpenFOAM 4.0, bad option -t in zsh
  #1
Senior Member
 
rdbisme's Avatar
 
Ruben Di Battista
Join Date: May 2013
Location: Paris
Posts: 137
Rep Power: 13
rdbisme is on a distinguished road
Hello everybody,

I'm in the process of passing from OF 3.0.1 to OF 4.0. Meanwhile I also changed my shell from bash to zsh + OMZ since that is the shell I naturally use on my personal machines.

I'm experiencing a problem with the initial setup of the environment, in particular:

Code:
source OpenFOAM-4.0/etc/bashrc
returns an error:
Code:
OpenFOAM-4.0/etc/config.sh/aliases:73 bad option -t
I had no issues with OF3.0.1. In facts if we check the two different bashrc configuration scripts:

OpenFOAM 4.0

OpenFOAM 3.0.x

in the new version we have:

Code:
[ "$(type -t wmRefresh)" = "alias" ] && unalias wmRefresh || unset wmRefresh
The type builtin has different arguments in bash and in zsh

bash
Code:
type
 type [-afptP] [name …]
zsh
Code:
type [ -wfpamsS ] name ...

# Equivalent to whence -v
In particular no -t option is available. In zsh the most similar command to type -t would be, I guess, type -w (that prints a <name>: <type> string instead of just <type> as for bash's type command).
I'm not a shell ninja, but anyone among you knows a cross-platform solution to this bug?
rdbisme is offline   Reply With Quote

Old   November 1, 2016, 08:02
Default
  #2
Senior Member
 
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 125
Rep Power: 12
Taataa is on a distinguished road
Just replace the line that includes the -t option with this one:

[ "$(type wmRefresh | awk '{print $4}')" = "alias" ] && unalias wmRefresh || unset wmRefresh

I found the answer here.
wyldckat likes this.
Taataa is offline   Reply With Quote

Old   November 2, 2016, 09:46
Default
  #3
Senior Member
 
rdbisme's Avatar
 
Ruben Di Battista
Join Date: May 2013
Location: Paris
Posts: 137
Rep Power: 13
rdbisme is on a distinguished road
Quote:
Originally Posted by Taataa View Post
Just replace the line that includes the -t option with this one:

[ "$(type wmRefresh | awk '{print $4}')" = "alias" ] && unalias wmRefresh || unset wmRefresh

I found the answer here.
Thanks for your help. What I did was:

Code:
[[ "$(type wmRefresh)" =~ "alias" ]] && unalias wmRefresh || unset wmRefresh
that should be portable also with bash. Basically looking for the word "alias" in the output of type. In bash it should print something like 'wmRefresh aliased to' and it should validate correctly. Didn't check though.
arvindpj likes this.
rdbisme is offline   Reply With Quote

Old   December 30, 2016, 12:10
Default Working in zsh shell
  #4
Member
 
Arvind Jay
Join Date: Sep 2012
Posts: 96
Rep Power: 15
arvindpj is on a distinguished road
Here is the update on this.

Replace this L73: in etc/configh.sh/aliases :
Code:
[ "$(type -t wmRefresh)" = "alias" ] && unalias wmRefresh || unset wmRefresh
with this:

Code:
# For backward-compatibility unalias wmRefresh if it is defined as an alias
if declare -f wmRefresh > /dev/null
then
    unset wmRefresh
else
    unalias wmRefresh 2> /dev/null
fi
Cheers
arvindpj is offline   Reply With Quote

Reply

Tags
bash, openfoam 4.0, openfoam-4.0, zsh

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wind turbine simulation Saturn CFX 60 July 17, 2024 05:45
Domain Reference Pressure and mass flow inlet boundary AdidaKK CFX 75 August 20, 2018 05:37
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 05:21
Wrong multiphase flow at rotating interface Sanyo CFX 14 February 7, 2017 17:19
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 04:05


All times are GMT -4. The time now is 21:06.