File: export.rst

package info (click to toggle)
fish 4.2.1-3.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,976 kB
  • sloc: python: 6,972; javascript: 1,407; sh: 1,009; xml: 411; ansic: 230; objc: 78; makefile: 20
file content (48 lines) | stat: -rw-r--r-- 1,060 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
export - compatibility function for exporting variables
=======================================================

Synopsis
--------

.. synopsis::

    export
    export NAME=VALUE


Description
-----------

``export`` is a function included for compatibility with POSIX shells. In general, the :doc:`set <set>` 
builtin should be used instead.

When called without arguments, ``export`` prints a list of currently-exported variables, like ``set
-x``.

When called with a ``NAME=VALUE`` pair, the variable ``NAME`` is set to ``VALUE`` in the global
scope, and exported as an environment variable to other commands.

There are no options available.

Example
-------

The following commands have an identical effect.

::

    set -gx PAGER bat
    export PAGER=bat

Note: If you want to add to e.g. ``$PATH``, you need to be careful to :ref:`combine the list <cartesian-product>`. Quote it, like so::

    export PATH="$PATH:/opt/bin"

Or just use ``set``, which avoids this::

    set -gx PATH $PATH /opt/bin

See more
--------

1. The :doc:`set <set>` command.