# Cling startup scripts support

**URL:** <https://root-forum.cern.ch/t/cling-startup-scripts-support/51358>\
**Category:** Cling\
**Tags:** feature\
**Created:** [August 26, 2022, 2:58pm UTC](https://root-forum.cern.ch/t/cling-startup-scripts-support/51358 "2022-08-26T14:58:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiangyilism](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jiangyilism/32/30727_2.png) [@jiangyilism](https://root-forum.cern.ch/u/jiangyilism)\
**Post date:** [August 26, 2022, 2:58pm UTC](https://root-forum.cern.ch/t/cling-startup-scripts-support/51358/1 "2022-08-26T14:58:06Z")

</div>

Many interpreters support startup script being executed before command prompt.  
I propose to add the following features similar to python ($PYTHONSTARTUP), bash(.bashrc, .bash\_profile), zsh (.zprofile, .zshrc) :

1. If the file `.cling_profile` exists, cling binary executes it after launch and right before doing “real work” (showing command promt or executing scripts from argv).

2. If the file `.clingrc` exists, cling execute it after `.cling_profile` and before the “real work”. However, only do this when cling is invoked as in the interactive mode (the mode with a command prompt).

3. Search order for `.cling_profile` and `.clingrc`:

P.S. I have implemented the above features and used them on my local cling. I would like to collect some feedback before creating a pull request.

---

<div class="post-metadata">

**Author:** ![jiangyilism](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jiangyilism/32/30727_2.png) [@jiangyilism](https://root-forum.cern.ch/u/jiangyilism)\
**Post date:** [August 27, 2022, 7:45pm UTC](https://root-forum.cern.ch/t/cling-startup-scripts-support/51358/2 "2022-08-27T19:45:19Z")

</div>

The PR is created. PR #11262 . Unfortunately as a new forum user I cannot post the hyperlink here.

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [August 29, 2022, 8:56am UTC](https://root-forum.cern.ch/t/cling-startup-scripts-support/51358/3 "2022-08-29T08:56:15Z")

</div>

Thank you @jiangyilism – discussion continues at [[cling] Startup script support by jiangyilism · Pull Request #11262 · root-project/root · GitHub](https://github.com/root-project/root/pull/11262) , I guess 🙂

Cheers,  
Enrico

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [September 12, 2022, 8:56am UTC](https://root-forum.cern.ch/t/cling-startup-scripts-support/51358/4 "2022-09-12T08:56:46Z")

</div>

Closed on September 12, 2022, 8:56am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
