Skip to content

Instantly share code, notes, and snippets.

@znorris
Forked from zombiezen/.profile
Created December 9, 2017 00:03
Show Gist options
  • Save znorris/562a39884b63ef4517b1ffac6d29806d to your computer and use it in GitHub Desktop.
Save znorris/562a39884b63ef4517b1ffac6d29806d to your computer and use it in GitHub Desktop.
zsh on Google Cloud Shell
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if [ -n "$BASH_VERSION" ]; then
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# Assume that you ran: ./configure --prefix=$HOME/zsh && make -j2 && make install
[ -f $HOME/zsh/bin/zsh ] && exec $HOME/zsh/bin/zsh
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if [[ -e "/google/google-cloud-sdk/path.zsh.inc" ]]; then
source "/google/google-cloud-sdk/path.zsh.inc"
fi
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
setopt promptsubst
PROMPT='%n@${DEVSHELL_PROJECT_ID:-cloudshell}:%~ %(!.#.Z) '
if [[ -e "/google/google-cloud-sdk/completion.zsh.inc" ]]; then
source "/google/google-cloud-sdk/completion.zsh.inc"
fi
onexit () {
for FILE in /google/devshell/bash_exit.google.d/*; do
if [ -x "$FILE" ]; then
"$FILE"
fi
done
}
trap onexit EXIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment