# setenv script or code



## max21 (Feb 23, 2015)

Could someone make this run in a script?  I been trying all night but it seems impossible because the warning I get is that env is a built-in into the shell, itself.  Maybe someone knows of a workaround.  If it is not, would someone have some c or C++ code that can get the job done?


```
ENTER ENVIROMENT:

setenv JAILDIR /jails/nginx_server
```


----------



## max21 (Feb 23, 2015)

While searching; the closest I came is within this thread but for my experiment it’s only a starting point that should help when dealing with a desktop and its jails.  Opening a terminal automatically was nearly impossible to find... i did not think desktop gnome until a few hours ago, but I guest someone figured out what my questions were related to.  Autostart is no problem … All I got to do now is figure out how to paste that one command on its command line with a script that will also close the window.  Any ideas?

https://askubuntu.com/questions/536...ertain-text-already-input-on-the-command-line

Seem to be a match same time from difference sections of the globe . . . satriani thread below may be related to the same thing at the … our _enviroment_, but surely nullfs.


----------



## wblock@ (Feb 23, 2015)

What software is asking that question?

Which shell is being used?  `setenv` is for csh(1):


```
setenv JAILDIR /jails/nginx_server
```

sh(1) is different:

```
JAILDIR=/jails/nginx_server ; export JAILDIR
```


----------



## max21 (Feb 23, 2015)

> Which shell is being used? setenv is for csh(1):




```
root@com1:~ # setenv JAILDIR /jails/nginx_server
root@com1:~#
```



> sh(1) is different:




```
root@com1:~ # JAILDIR=/jails/nginx_server ; export JAILDIR
JAILDIR=/jails/nginx_server: Command not found.
export: Command not found
```
I see csh(1), but what do sh(1) require?  Is bash correct?  Since your sequence seem to make things happen (exporting to get out of the cage), it seem to be exactly what I need. I’m going to have to make some changes, when I know for sure what to change. Trial and error is wearing me out.

FreeBSD say default is tcsh(1). I always use sh(1) for simple scripting only because samples can be found everywhere.  I bet one those ports changed my default on its own.  I have too many to list.  I did not install bash but JAVA and whoever installed difference versions of bash, php, and other ports of the same name, claiming certain versions as dependency.

What is my default according to the list below?  It looks like bash to me but I’m not really sure?  This is what I have and I never touch it, _ever_!  Last time I did `chsh` was on 8.2.  It was just something to do to be cool.  I never got serious until 10.0-10.1.  So please forgive for my ignorance.  I’m learning at the speed-of-light these days.  So my default is csh, and I'm using bash on csh 

```
/bin/sh
/bin/csh
/bin/tcsh
/usr/local/bin/[b]bash[/b]
/usr/local/bin/rbash
/usr/local/bin/ksh93
```
¯\_(ツ)_/¯


----------



## max21 (Feb 23, 2015)

wblock@ said:


> Which shell is being used?


Hummm … I finally peep your reference to the Doctor wblock@

https://forums.freebsd.org/threads/which-shell-do-you-use.821/


> Using csh. When running and testing some scripts switching from csh to sh or bash if needed but more simple to add at the start of script file signature like *#!/bin/sh #!/usr/bin/perl etc*.
> 
> Dr_Phoenix



I don’t know how to Thank You


----------

