# Paste default environment file
echo "PATH=/usr/local/sbin:/usr/local/bin:/opt/local/sbin:/opt/local/bin:/usr/sbin:/usr/bin:/sbin" > \
	/opt/gogs/.ssh/environment

# Enable environment configuration for users
gsed -i -e 's:.*PermitUserEnvironment.*no:PermitUserEnvironment yes:g' \
	/etc/ssh/sshd_config

# Enable gogs service
svcadm enable svc:/application/gogs:default

# Paste default environment file
echo "PATH=/usr/local/sbin:/usr/local/bin:/opt/local/sbin:/opt/local/bin:/usr/sbin:/usr/bin:/sbin" > \
	/opt/gogs/.ssh/environment

# Enable environment configuration for users
sed -e 's:.*PermitUserEnvironment.*no:PermitUserEnvironment yes:g' \
	/etc/ssh/sshd_config

# Enable gogs service
svcadm enable svc:/application/gogs:default

--- 
+++ 
@@ -3,7 +3,7 @@
 	/opt/gogs/.ssh/environment
 
 # Enable environment configuration for users
-sed -e 's:.*PermitUserEnvironment.*no:PermitUserEnvironment yes:g' \
+gsed -i -e 's:.*PermitUserEnvironment.*no:PermitUserEnvironment yes:g' \
 	/etc/ssh/sshd_config
 
 # Enable gogs service
Use gsed and -i option
