Skip to content

Commit 1365639

Browse files
committed
fix unix script
1 parent d19f47b commit 1365639

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

gitty/token/script/d_l.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,18 @@ func (s *Script) execute() error {
2929

3030
// save creates a script to set an environment variable with a specified key and value.
3131
func save(key, value string) *Script {
32-
arg := fmt.Sprintf("%s=%s", key, value)
32+
arg := fmt.Sprintf("export %s=%s && echo 'export %s=%s' >> ~/.bashrc", key, value, key, value)
3333
return &Script{
34-
cmd: exec.Command("bash", "-c", "export", arg),
34+
cmd: exec.Command("bash", "-c", arg),
3535
msg: msgSaved,
3636
}
3737
}
3838

3939
// del creates a script to delete a key from the os environment.
4040
func del(key string) *Script {
41+
arg := fmt.Sprintf("sed -i '/^export %s=/d' ~/.bashrc", key)
4142
return &Script{
42-
cmd: exec.Command("bash", "-c", "unset", key),
43+
cmd: exec.Command("bash", "-c", arg),
4344
msg: msgDeleted,
4445
}
4546
}

0 commit comments

Comments
 (0)